@galacean/engine-physics-physx 0.0.0-experimental-backup.0 → 0.0.0-experimental-2.0-game
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1966 -0
- package/dist/browser.js.map +1 -0
- package/dist/browser.min.js +2 -0
- package/dist/browser.min.js.map +1 -0
- package/dist/main.js +1962 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +1956 -0
- package/dist/module.js.map +1 -0
- package/libs/physx.release.js +2 -21
- package/libs/physx.release.simd.js +2 -0
- package/libs/physx.release.simd.wasm +0 -0
- package/libs/physx.release.wasm +0 -0
- package/package.json +4 -4
- package/types/PhysXCharacterController.d.ts +59 -0
- package/types/PhysXCollider.d.ts +36 -0
- package/types/PhysXDynamicCollider.d.ts +130 -0
- package/types/PhysXPhysics.d.ts +107 -0
- package/types/PhysXPhysicsManager.d.ts +3 -0
- package/types/PhysXPhysicsMaterial.d.ts +47 -0
- package/types/PhysXPhysicsScene.d.ts +112 -0
- package/types/PhysXStaticCollider.d.ts +11 -0
- package/types/enum/PhysXRuntimeMode.d.ts +11 -0
- package/types/index.d.ts +3 -0
- package/types/joint/PhysXFixedJoint.d.ts +10 -0
- package/types/joint/PhysXHingeJoint.d.ts +57 -0
- package/types/joint/PhysXJoint.d.ts +68 -0
- package/types/joint/PhysXSpringJoint.d.ts +30 -0
- package/types/shape/PhysXBoxColliderShape.d.ts +25 -0
- package/types/shape/PhysXCapsuleColliderShape.d.ts +42 -0
- package/types/shape/PhysXColliderShape.d.ts +68 -0
- package/types/shape/PhysXMeshColliderShape.d.ts +32 -0
- package/types/shape/PhysXPlaneColliderShape.d.ts +10 -0
- package/types/shape/PhysXSphereColliderShape.d.ts +21 -0
- package/libs/physx.release.downgrade.js +0 -58
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Ray, Vector3, Quaternion } from "@galacean/engine";
|
|
2
|
+
import { IPhysicsScene, IPhysicsEvents, ITriggerEvent } from "@galacean/engine-design";
|
|
3
|
+
import { PhysXCharacterController } from "./PhysXCharacterController";
|
|
4
|
+
import { PhysXCollider } from "./PhysXCollider";
|
|
5
|
+
import { PhysXPhysics } from "./PhysXPhysics";
|
|
6
|
+
import { PhysXPhysicsManager } from "./PhysXPhysicsManager";
|
|
7
|
+
/**
|
|
8
|
+
* A manager is a collection of colliders and constraints which can interact.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PhysXPhysicsScene implements IPhysicsScene {
|
|
11
|
+
private static _tempPosition;
|
|
12
|
+
private static _tempQuaternion;
|
|
13
|
+
private static _tempNormal;
|
|
14
|
+
private static _tempPose;
|
|
15
|
+
private static _tempShapeIDs;
|
|
16
|
+
private _boxGeometry;
|
|
17
|
+
private _sphereGeometry;
|
|
18
|
+
private _capsuleGeometry;
|
|
19
|
+
private _physXPhysics;
|
|
20
|
+
private _physXManager;
|
|
21
|
+
private _pxRaycastHit;
|
|
22
|
+
private _pxFilterData;
|
|
23
|
+
private _pxScene;
|
|
24
|
+
private _physXSimulationCallbackInstance;
|
|
25
|
+
private _activeTriggers;
|
|
26
|
+
private _contactEvents;
|
|
27
|
+
private _contactEventCount;
|
|
28
|
+
private _triggerEvents;
|
|
29
|
+
private _physicsEvents;
|
|
30
|
+
private _triggerEventPool;
|
|
31
|
+
constructor(physXPhysics: PhysXPhysics, physicsManager: PhysXPhysicsManager);
|
|
32
|
+
/**
|
|
33
|
+
* {@inheritDoc IPhysicsScene.setGravity }
|
|
34
|
+
*/
|
|
35
|
+
setGravity(value: Vector3): void;
|
|
36
|
+
/**
|
|
37
|
+
* {@inheritDoc IPhysicsScene.addCollider }
|
|
38
|
+
*/
|
|
39
|
+
addCollider(collider: PhysXCollider): void;
|
|
40
|
+
/**
|
|
41
|
+
* {@inheritDoc IPhysicsScene.removeCollider }
|
|
42
|
+
*/
|
|
43
|
+
removeCollider(collider: PhysXCollider): void;
|
|
44
|
+
/**
|
|
45
|
+
* {@inheritDoc IPhysicsScene.addCharacterController }
|
|
46
|
+
*/
|
|
47
|
+
addCharacterController(characterController: PhysXCharacterController): void;
|
|
48
|
+
/**
|
|
49
|
+
* {@inheritDoc IPhysicsScene.removeCharacterController }
|
|
50
|
+
*/
|
|
51
|
+
removeCharacterController(characterController: PhysXCharacterController): void;
|
|
52
|
+
/**
|
|
53
|
+
* {@inheritDoc IPhysicsScene.update }
|
|
54
|
+
*/
|
|
55
|
+
update(elapsedTime: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* {@inheritDoc IPhysicsScene.updateEvents }
|
|
58
|
+
*/
|
|
59
|
+
updateEvents(): IPhysicsEvents;
|
|
60
|
+
/**
|
|
61
|
+
* {@inheritDoc IPhysicsScene.raycast }
|
|
62
|
+
*/
|
|
63
|
+
raycast(ray: Ray, distance: number, onRaycast: (obj: number) => boolean, hit?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* {@inheritDoc IPhysicsScene.boxCast }
|
|
66
|
+
*/
|
|
67
|
+
boxCast(center: Vector3, orientation: Quaternion, halfExtents: Vector3, direction: Vector3, distance: number, onSweep: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* {@inheritDoc IPhysicsScene.sphereCast }
|
|
70
|
+
*/
|
|
71
|
+
sphereCast(center: Vector3, radius: number, direction: Vector3, distance: number, onSweep: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* {@inheritDoc IPhysicsScene.capsuleCast }
|
|
74
|
+
*/
|
|
75
|
+
capsuleCast(center: Vector3, radius: number, height: number, orientation: Quaternion, direction: Vector3, distance: number, onSweep: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* {@inheritDoc IPhysicsScene.overlapBoxAll }
|
|
78
|
+
*/
|
|
79
|
+
overlapBoxAll(center: Vector3, orientation: Quaternion, halfExtents: Vector3, onOverlap: (obj: number) => boolean): number[];
|
|
80
|
+
/**
|
|
81
|
+
* {@inheritDoc IPhysicsScene.overlapSphereAll }
|
|
82
|
+
*/
|
|
83
|
+
overlapSphereAll(center: Vector3, radius: number, onOverlap: (obj: number) => boolean): number[];
|
|
84
|
+
/**
|
|
85
|
+
* {@inheritDoc IPhysicsScene.overlapCapsuleAll }
|
|
86
|
+
*/
|
|
87
|
+
overlapCapsuleAll(center: Vector3, radius: number, height: number, orientation: Quaternion, onOverlap: (obj: number) => boolean): number[];
|
|
88
|
+
/**
|
|
89
|
+
* {@inheritDoc IPhysicsScene.gc }
|
|
90
|
+
*/
|
|
91
|
+
gc(): void;
|
|
92
|
+
/**
|
|
93
|
+
* {@inheritDoc IPhysicsScene.destroy }
|
|
94
|
+
*/
|
|
95
|
+
destroy(): void;
|
|
96
|
+
private _sweepSingle;
|
|
97
|
+
private _overlapMultiple;
|
|
98
|
+
private _simulate;
|
|
99
|
+
private _fetchResults;
|
|
100
|
+
private _getTrigger;
|
|
101
|
+
private _bufferContactEvent;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Trigger event to store interactive object ids and state.
|
|
105
|
+
*/
|
|
106
|
+
export declare class TriggerEvent implements ITriggerEvent {
|
|
107
|
+
state: number;
|
|
108
|
+
dispatchState: number;
|
|
109
|
+
index1: number;
|
|
110
|
+
index2: number;
|
|
111
|
+
constructor(index1: number, index2: number);
|
|
112
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IStaticCollider } from "@galacean/engine-design";
|
|
2
|
+
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
3
|
+
import { PhysXCollider } from "./PhysXCollider";
|
|
4
|
+
import { PhysXPhysics } from "./PhysXPhysics";
|
|
5
|
+
/**
|
|
6
|
+
* A static collider component that will not move.
|
|
7
|
+
* @remarks Mostly used for object which always stays at the same place and never moves around.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PhysXStaticCollider extends PhysXCollider implements IStaticCollider {
|
|
10
|
+
constructor(physXPhysics: PhysXPhysics, position: Vector3, rotation: Quaternion);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PhysX runtime mode.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum PhysXRuntimeMode {
|
|
5
|
+
/** Use WebAssembly SIMD mode first, then WebAssembly as fallback. */
|
|
6
|
+
Auto = 0,
|
|
7
|
+
/** WebAssembly mode. */
|
|
8
|
+
WebAssembly = 1,
|
|
9
|
+
/** WebAssembly SIMD mode. */
|
|
10
|
+
WebAssemblySIMD = 2
|
|
11
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IFixedJoint } from "@galacean/engine-design";
|
|
2
|
+
import { PhysXCollider } from "../PhysXCollider";
|
|
3
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
4
|
+
import { PhysXJoint } from "./PhysXJoint";
|
|
5
|
+
/**
|
|
6
|
+
* A fixed joint permits no relative movement between two colliders. ie the bodies are glued together.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PhysXFixedJoint extends PhysXJoint implements IFixedJoint {
|
|
9
|
+
constructor(physXPhysics: PhysXPhysics, collider: PhysXCollider);
|
|
10
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { IHingeJoint } from "@galacean/engine-design";
|
|
2
|
+
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
3
|
+
import { PhysXCollider } from "../PhysXCollider";
|
|
4
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
5
|
+
import { PhysXJoint } from "./PhysXJoint";
|
|
6
|
+
/**
|
|
7
|
+
* A joint which behaves in a similar way to a hinge or axle.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PhysXHingeJoint extends PhysXJoint implements IHingeJoint {
|
|
10
|
+
protected static _xAxis: Vector3;
|
|
11
|
+
private _axis;
|
|
12
|
+
private _axisRotationQuaternion;
|
|
13
|
+
private _connectedAxisRotationQuaternion;
|
|
14
|
+
constructor(physXPhysics: PhysXPhysics, collider: PhysXCollider);
|
|
15
|
+
setRotation(value: Quaternion): void;
|
|
16
|
+
/**
|
|
17
|
+
* {@inheritDoc IHingeJoint.setAxis }
|
|
18
|
+
*/
|
|
19
|
+
setAxis(value: Vector3): void;
|
|
20
|
+
setAnchor(value: Vector3): void;
|
|
21
|
+
/**
|
|
22
|
+
* {@inheritDoc IJoint.setConnectedAnchor }
|
|
23
|
+
*/
|
|
24
|
+
setConnectedAnchor(value: Vector3): void;
|
|
25
|
+
/**
|
|
26
|
+
* {@inheritDoc IHingeJoint.getAngle }
|
|
27
|
+
*/
|
|
28
|
+
getAngle(): number;
|
|
29
|
+
/**
|
|
30
|
+
* {@inheritDoc IHingeJoint.getVelocity }
|
|
31
|
+
*/
|
|
32
|
+
getVelocity(): Readonly<number>;
|
|
33
|
+
/**
|
|
34
|
+
* {@inheritDoc IHingeJoint.setHardLimitCone }
|
|
35
|
+
*/
|
|
36
|
+
setHardLimit(lowerLimit: number, upperLimit: number, contactDist: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* {@inheritDoc IHingeJoint.setHardLimitCone }
|
|
39
|
+
*/
|
|
40
|
+
setSoftLimit(lowerLimit: number, upperLimit: number, stiffness: number, damping: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* {@inheritDoc IHingeJoint.setDriveVelocity }
|
|
43
|
+
*/
|
|
44
|
+
setDriveVelocity(velocity: number, autowake?: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* {@inheritDoc IHingeJoint.setDriveForceLimit }
|
|
47
|
+
*/
|
|
48
|
+
setDriveForceLimit(limit: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* {@inheritDoc IHingeJoint.setDriveGearRatio }
|
|
51
|
+
*/
|
|
52
|
+
setDriveGearRatio(ratio: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* {@inheritDoc IHingeJoint.setHingeJointFlag }
|
|
55
|
+
*/
|
|
56
|
+
setHingeJointFlag(flag: number, value: boolean): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IJoint } from "@galacean/engine-design";
|
|
2
|
+
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
3
|
+
import { PhysXCollider } from "../PhysXCollider";
|
|
4
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
5
|
+
/**
|
|
6
|
+
* a base interface providing common functionality for PhysX joints
|
|
7
|
+
*/
|
|
8
|
+
export declare class PhysXJoint implements IJoint {
|
|
9
|
+
protected static _defaultVec: Vector3;
|
|
10
|
+
protected static _defaultQuat: Quaternion;
|
|
11
|
+
protected _pxJoint: any;
|
|
12
|
+
protected _anchor: Vector3;
|
|
13
|
+
protected _connectedAnchor: Vector3;
|
|
14
|
+
protected _rotation: Quaternion;
|
|
15
|
+
protected _collider: PhysXCollider;
|
|
16
|
+
private _breakForce;
|
|
17
|
+
private _breakTorque;
|
|
18
|
+
protected _physXPhysics: PhysXPhysics;
|
|
19
|
+
constructor(physXPhysics: PhysXPhysics);
|
|
20
|
+
/**
|
|
21
|
+
* {@inheritDoc IJoint.setConnectedCollider }
|
|
22
|
+
*/
|
|
23
|
+
setConnectedCollider(value: PhysXCollider): void;
|
|
24
|
+
/**
|
|
25
|
+
* {@inheritDoc IJoint.setConnectedAnchor }
|
|
26
|
+
*/
|
|
27
|
+
setAnchor(value: Vector3): void;
|
|
28
|
+
/**
|
|
29
|
+
* {@inheritDoc IJoint.setConnectedAnchor }
|
|
30
|
+
*/
|
|
31
|
+
setConnectedAnchor(value: Vector3): void;
|
|
32
|
+
setRotation(value: Quaternion): void;
|
|
33
|
+
/**
|
|
34
|
+
* {@inheritDoc IJoint.setMassScale }
|
|
35
|
+
*/
|
|
36
|
+
setMassScale(value: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* {@inheritDoc IJoint.setConnectedMassScale }
|
|
39
|
+
*/
|
|
40
|
+
setConnectedMassScale(value: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* {@inheritDoc IJoint.setInertiaScale }
|
|
43
|
+
*/
|
|
44
|
+
setInertiaScale(value: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* {@inheritDoc IJoint.setConnectedInertiaScale }
|
|
47
|
+
*/
|
|
48
|
+
setConnectedInertiaScale(value: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* {@inheritDoc IJoint.setBreakForce }
|
|
51
|
+
*/
|
|
52
|
+
setBreakForce(value: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* {@inheritDoc IJoint.setBreakTorque }
|
|
55
|
+
*/
|
|
56
|
+
setBreakTorque(value: number): void;
|
|
57
|
+
/**
|
|
58
|
+
* {@inheritDoc IJoint.destroy }
|
|
59
|
+
*/
|
|
60
|
+
destroy(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Set the joint local pose for an actor.
|
|
63
|
+
* @param actor 0 for the first actor, 1 for the second actor.
|
|
64
|
+
* @param position the local position for the actor this joint
|
|
65
|
+
* @param rotation the local rotation for the actor this joint
|
|
66
|
+
*/
|
|
67
|
+
protected _setLocalPose(actor: number, position: Vector3, rotation: Quaternion): void;
|
|
68
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
2
|
+
import { PhysXJoint } from "./PhysXJoint";
|
|
3
|
+
import { ISpringJoint } from "@galacean/engine-design";
|
|
4
|
+
import { PhysXCollider } from "../PhysXCollider";
|
|
5
|
+
/**
|
|
6
|
+
* a joint that maintains an upper or lower bound (or both) on the distance between two points on different objects
|
|
7
|
+
*/
|
|
8
|
+
export declare class PhysXSpringJoint extends PhysXJoint implements ISpringJoint {
|
|
9
|
+
constructor(physXPhysics: PhysXPhysics, collider: PhysXCollider);
|
|
10
|
+
/**
|
|
11
|
+
* {@inheritDoc ISpringJoint.setMinDistance }
|
|
12
|
+
*/
|
|
13
|
+
setMinDistance(distance: number): void;
|
|
14
|
+
/**
|
|
15
|
+
* {@inheritDoc ISpringJoint.setMaxDistance }
|
|
16
|
+
*/
|
|
17
|
+
setMaxDistance(distance: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* {@inheritDoc ISpringJoint.setTolerance }
|
|
20
|
+
*/
|
|
21
|
+
setTolerance(tolerance: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* {@inheritDoc ISpringJoint.setStiffness }
|
|
24
|
+
*/
|
|
25
|
+
setStiffness(stiffness: number): void;
|
|
26
|
+
/**
|
|
27
|
+
* {@inheritDoc ISpringJoint.setDamping }
|
|
28
|
+
*/
|
|
29
|
+
setDamping(damping: number): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Vector3 } from "@galacean/engine";
|
|
2
|
+
import { IBoxColliderShape } from "@galacean/engine-design";
|
|
3
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
4
|
+
import { PhysXPhysicsMaterial } from "../PhysXPhysicsMaterial";
|
|
5
|
+
import { PhysXColliderShape } from "./PhysXColliderShape";
|
|
6
|
+
/**
|
|
7
|
+
* Box collider shape in PhysX.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PhysXBoxColliderShape extends PhysXColliderShape implements IBoxColliderShape {
|
|
10
|
+
private static _tempHalfExtents;
|
|
11
|
+
constructor(physXPhysics: PhysXPhysics, uniqueID: number, size: Vector3, material: PhysXPhysicsMaterial);
|
|
12
|
+
/**
|
|
13
|
+
* {@inheritDoc IBoxColliderShape.setSize }
|
|
14
|
+
*/
|
|
15
|
+
setSize(value: Vector3): void;
|
|
16
|
+
/**
|
|
17
|
+
* {@inheritDoc IColliderShape.setRotation }
|
|
18
|
+
*/
|
|
19
|
+
setRotation(value: Vector3): void;
|
|
20
|
+
/**
|
|
21
|
+
* {@inheritDoc IColliderShape.setWorldScale }
|
|
22
|
+
*/
|
|
23
|
+
setWorldScale(scale: Vector3): void;
|
|
24
|
+
private _updateController;
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ICapsuleColliderShape } from "@galacean/engine-design";
|
|
2
|
+
import { Vector3 } from "@galacean/engine";
|
|
3
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
4
|
+
import { PhysXPhysicsMaterial } from "../PhysXPhysicsMaterial";
|
|
5
|
+
import { PhysXColliderShape } from "./PhysXColliderShape";
|
|
6
|
+
/**
|
|
7
|
+
* Capsule collider shape in PhysX.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PhysXCapsuleColliderShape extends PhysXColliderShape implements ICapsuleColliderShape {
|
|
10
|
+
constructor(physXPhysics: PhysXPhysics, uniqueID: number, radius: number, height: number, material: PhysXPhysicsMaterial);
|
|
11
|
+
/**
|
|
12
|
+
* {@inheritDoc ICapsuleColliderShape.setRadius }
|
|
13
|
+
*/
|
|
14
|
+
setRadius(value: number): void;
|
|
15
|
+
/**
|
|
16
|
+
* {@inheritDoc ICapsuleColliderShape.setHeight }
|
|
17
|
+
*/
|
|
18
|
+
setHeight(value: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* {@inheritDoc ICapsuleColliderShape.setRotation }
|
|
21
|
+
*/
|
|
22
|
+
setRotation(value: Vector3): void;
|
|
23
|
+
/**
|
|
24
|
+
* {@inheritDoc ICapsuleColliderShape.setUpAxis }
|
|
25
|
+
*/
|
|
26
|
+
setUpAxis(upAxis: ColliderShapeUpAxis): void;
|
|
27
|
+
/**
|
|
28
|
+
* {@inheritDoc IColliderShape.setWorldScale }
|
|
29
|
+
*/
|
|
30
|
+
setWorldScale(scale: Vector3): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The up axis of the collider shape.
|
|
34
|
+
*/
|
|
35
|
+
export declare enum ColliderShapeUpAxis {
|
|
36
|
+
/** Up axis is X. */
|
|
37
|
+
X = 0,
|
|
38
|
+
/** Up axis is Y. */
|
|
39
|
+
Y = 1,
|
|
40
|
+
/** Up axis is Z. */
|
|
41
|
+
Z = 2
|
|
42
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Quaternion, Vector3, Vector4 } from "@galacean/engine";
|
|
2
|
+
import { IColliderShape } from "@galacean/engine-design";
|
|
3
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
4
|
+
import { PhysXPhysicsMaterial } from "../PhysXPhysicsMaterial";
|
|
5
|
+
/**
|
|
6
|
+
* Flags which affect the behavior of Shapes.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ShapeFlag {
|
|
9
|
+
/** The shape will partake in collision in the physical simulation. */
|
|
10
|
+
SIMULATION_SHAPE = 1,
|
|
11
|
+
/** The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...). */
|
|
12
|
+
SCENE_QUERY_SHAPE = 2,
|
|
13
|
+
/** The shape is a trigger which can send reports whenever other shapes enter/leave its volume. */
|
|
14
|
+
TRIGGER_SHAPE = 4
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Abstract class for collider shapes.
|
|
18
|
+
*/
|
|
19
|
+
export declare abstract class PhysXColliderShape implements IColliderShape {
|
|
20
|
+
static readonly halfSqrt: number;
|
|
21
|
+
static transform: {
|
|
22
|
+
translation: Vector3;
|
|
23
|
+
rotation: any;
|
|
24
|
+
};
|
|
25
|
+
protected static _tempVector4: Vector4;
|
|
26
|
+
protected _physXPhysics: PhysXPhysics;
|
|
27
|
+
protected _pxGeometry: any;
|
|
28
|
+
protected _axis: Quaternion;
|
|
29
|
+
protected _physXRotation: Quaternion;
|
|
30
|
+
private _shapeFlags;
|
|
31
|
+
constructor(physXPhysics: PhysXPhysics);
|
|
32
|
+
/**
|
|
33
|
+
* {@inheritDoc IColliderShape.setRotation }
|
|
34
|
+
*/
|
|
35
|
+
setRotation(value: Vector3): void;
|
|
36
|
+
/**
|
|
37
|
+
* {@inheritDoc IColliderShape.setPosition }
|
|
38
|
+
*/
|
|
39
|
+
setPosition(value: Vector3): void;
|
|
40
|
+
/**
|
|
41
|
+
* {@inheritDoc IColliderShape.setWorldScale }
|
|
42
|
+
*/
|
|
43
|
+
setWorldScale(scale: Vector3): void;
|
|
44
|
+
/**
|
|
45
|
+
* {@inheritDoc IColliderShape.setContactOffset }
|
|
46
|
+
* @default 0.02f * PxTolerancesScale::length
|
|
47
|
+
*/
|
|
48
|
+
setContactOffset(offset: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* {@inheritDoc IColliderShape.setMaterial }
|
|
51
|
+
*/
|
|
52
|
+
setMaterial(value: PhysXPhysicsMaterial): void;
|
|
53
|
+
/**
|
|
54
|
+
* {@inheritDoc IColliderShape.setIsTrigger }
|
|
55
|
+
*/
|
|
56
|
+
setIsTrigger(value: boolean): void;
|
|
57
|
+
/**
|
|
58
|
+
* {@inheritDoc IColliderShape.pointDistance }
|
|
59
|
+
*/
|
|
60
|
+
pointDistance(point: Vector3): Vector4;
|
|
61
|
+
/**
|
|
62
|
+
* {@inheritDoc IColliderShape.destroy }
|
|
63
|
+
*/
|
|
64
|
+
destroy(): void;
|
|
65
|
+
protected _setLocalPose(): void;
|
|
66
|
+
protected _initialize(material: PhysXPhysicsMaterial, id: number): void;
|
|
67
|
+
private _modifyFlag;
|
|
68
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Vector3 } from "@galacean/engine";
|
|
2
|
+
import { IMeshColliderShape } from "@galacean/engine-design";
|
|
3
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
4
|
+
import { PhysXPhysicsMaterial } from "../PhysXPhysicsMaterial";
|
|
5
|
+
import { PhysXColliderShape } from "./PhysXColliderShape";
|
|
6
|
+
/**
|
|
7
|
+
* Mesh collider shape in PhysX.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PhysXMeshColliderShape extends PhysXColliderShape implements IMeshColliderShape {
|
|
10
|
+
private static _tightBoundsFlag;
|
|
11
|
+
private _pxMesh;
|
|
12
|
+
private _isConvex;
|
|
13
|
+
constructor(physXPhysics: PhysXPhysics, uniqueID: number, positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null, isConvex: boolean, material: PhysXPhysicsMaterial, cookingFlags: number);
|
|
14
|
+
/**
|
|
15
|
+
* {@inheritDoc IMeshColliderShape.setMeshData }
|
|
16
|
+
*/
|
|
17
|
+
setMeshData(positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null, isConvex: boolean, cookingFlags: number): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* {@inheritDoc IColliderShape.setWorldScale }
|
|
20
|
+
*/
|
|
21
|
+
setWorldScale(scale: Vector3): void;
|
|
22
|
+
/**
|
|
23
|
+
* {@inheritDoc IColliderShape.destroy }
|
|
24
|
+
*/
|
|
25
|
+
destroy(): void;
|
|
26
|
+
private _cookMesh;
|
|
27
|
+
private _logConvexCookingError;
|
|
28
|
+
private _logTriMeshCookingError;
|
|
29
|
+
private _allocatePositions;
|
|
30
|
+
private _allocateIndices;
|
|
31
|
+
private _updateGeometry;
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IPlaneColliderShape } from "@galacean/engine-design";
|
|
2
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
3
|
+
import { PhysXPhysicsMaterial } from "../PhysXPhysicsMaterial";
|
|
4
|
+
import { PhysXColliderShape } from "./PhysXColliderShape";
|
|
5
|
+
/**
|
|
6
|
+
* Plane collider shape in PhysX.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PhysXPlaneColliderShape extends PhysXColliderShape implements IPlaneColliderShape {
|
|
9
|
+
constructor(physXPhysics: PhysXPhysics, uniqueID: number, material: PhysXPhysicsMaterial);
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Vector3 } from "@galacean/engine";
|
|
2
|
+
import { ISphereColliderShape } from "@galacean/engine-design";
|
|
3
|
+
import { PhysXPhysics } from "../PhysXPhysics";
|
|
4
|
+
import { PhysXPhysicsMaterial } from "../PhysXPhysicsMaterial";
|
|
5
|
+
import { PhysXColliderShape } from "./PhysXColliderShape";
|
|
6
|
+
/**
|
|
7
|
+
* Sphere collider shape in PhysX.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PhysXSphereColliderShape extends PhysXColliderShape implements ISphereColliderShape {
|
|
10
|
+
private _radius;
|
|
11
|
+
private _maxScale;
|
|
12
|
+
constructor(physXPhysics: PhysXPhysics, uniqueID: number, radius: number, material: PhysXPhysicsMaterial);
|
|
13
|
+
/**
|
|
14
|
+
* {@inheritDoc ISphereColliderShape.setRadius }
|
|
15
|
+
*/
|
|
16
|
+
setRadius(value: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* {@inheritDoc IColliderShape.setWorldScale }
|
|
19
|
+
*/
|
|
20
|
+
setWorldScale(scale: Vector3): void;
|
|
21
|
+
}
|