@babylonjs/core 5.57.0 → 6.0.0

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.
Files changed (65) hide show
  1. package/Engines/WebGPU/Extensions/engine.multiRender.js +51 -8
  2. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  3. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +4 -3
  4. package/Engines/WebGPU/webgpuHardwareTexture.js +23 -10
  5. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  6. package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -1
  7. package/Engines/WebGPU/webgpuTextureHelper.js +6 -14
  8. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  9. package/Engines/engine.d.ts +5 -6
  10. package/Engines/thinEngine.js +2 -2
  11. package/Engines/thinEngine.js.map +1 -1
  12. package/Engines/webgpuEngine.js +16 -8
  13. package/Engines/webgpuEngine.js.map +1 -1
  14. package/Lights/Shadows/shadowGenerator.d.ts +2 -0
  15. package/Lights/Shadows/shadowGenerator.js +11 -22
  16. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  17. package/Maths/math.vector.js +4 -2
  18. package/Maths/math.vector.js.map +1 -1
  19. package/Meshes/abstractMesh.d.ts +13 -0
  20. package/Meshes/abstractMesh.js +20 -0
  21. package/Meshes/abstractMesh.js.map +1 -1
  22. package/Meshes/thinInstanceMesh.js +4 -1
  23. package/Meshes/thinInstanceMesh.js.map +1 -1
  24. package/Particles/solidParticleSystem.d.ts +1 -1
  25. package/Particles/solidParticleSystem.js +1 -1
  26. package/Particles/solidParticleSystem.js.map +1 -1
  27. package/Physics/physicsEngineComponent.d.ts +1 -0
  28. package/Physics/physicsEngineComponent.js +1 -0
  29. package/Physics/physicsEngineComponent.js.map +1 -1
  30. package/Physics/physicsHelper.d.ts +12 -5
  31. package/Physics/physicsHelper.js +160 -90
  32. package/Physics/physicsHelper.js.map +1 -1
  33. package/Physics/physicsRaycastResult.d.ts +9 -0
  34. package/Physics/physicsRaycastResult.js.map +1 -1
  35. package/Physics/v2/IPhysicsEnginePlugin.d.ts +120 -77
  36. package/Physics/v2/IPhysicsEnginePlugin.js +119 -48
  37. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  38. package/Physics/v2/Plugins/havokPlugin.d.ts +687 -0
  39. package/Physics/v2/Plugins/havokPlugin.js +1592 -0
  40. package/Physics/v2/Plugins/havokPlugin.js.map +1 -0
  41. package/Physics/v2/Plugins/index.d.ts +1 -0
  42. package/Physics/v2/Plugins/index.js +1 -1
  43. package/Physics/v2/Plugins/index.js.map +1 -1
  44. package/Physics/v2/index.d.ts +1 -0
  45. package/Physics/v2/index.js +2 -0
  46. package/Physics/v2/index.js.map +1 -1
  47. package/Physics/v2/physicsAggregate.d.ts +9 -2
  48. package/Physics/v2/physicsAggregate.js +66 -31
  49. package/Physics/v2/physicsAggregate.js.map +1 -1
  50. package/Physics/v2/physicsBody.d.ts +51 -62
  51. package/Physics/v2/physicsBody.js +101 -128
  52. package/Physics/v2/physicsBody.js.map +1 -1
  53. package/Physics/v2/physicsConstraint.d.ts +57 -25
  54. package/Physics/v2/physicsConstraint.js +32 -15
  55. package/Physics/v2/physicsConstraint.js.map +1 -1
  56. package/Physics/v2/physicsEngine.d.ts +0 -1
  57. package/Physics/v2/physicsEngine.js +0 -1
  58. package/Physics/v2/physicsEngine.js.map +1 -1
  59. package/Physics/v2/physicsEngineComponent.d.ts +0 -10
  60. package/Physics/v2/physicsEngineComponent.js +0 -29
  61. package/Physics/v2/physicsEngineComponent.js.map +1 -1
  62. package/Physics/v2/physicsShape.d.ts +52 -11
  63. package/Physics/v2/physicsShape.js +80 -23
  64. package/Physics/v2/physicsShape.js.map +1 -1
  65. package/package.json +1 -1
@@ -9,15 +9,14 @@ import type { PhysicsMaterial } from "./physicsMaterial";
9
9
  import type { Mesh } from "../../Meshes/mesh";
10
10
  import type { Nullable } from "../../types.js";
11
11
  import type { Observable } from "../../Misc/observable.js";
12
- /** @internal */
13
- export declare enum ConstraintAxisLimitMode {
12
+ /** How a specific axis can be constrained */
13
+ export declare enum PhysicsConstraintAxisLimitMode {
14
14
  FREE = 0,
15
15
  LIMITED = 1,
16
- LOCKED = 2,
17
- NONE = 3
16
+ LOCKED = 2
18
17
  }
19
- /** @internal */
20
- export declare enum ConstraintAxis {
18
+ /** The constraint specific axis to use when setting Friction, `ConstraintAxisLimitMode`, max force, ... */
19
+ export declare enum PhysicsConstraintAxis {
21
20
  LINEAR_X = 0,
22
21
  LINEAR_Y = 1,
23
22
  LINEAR_Z = 2,
@@ -26,17 +25,39 @@ export declare enum ConstraintAxis {
26
25
  ANGULAR_Z = 5,
27
26
  LINEAR_DISTANCE = 6
28
27
  }
29
- /** @internal */
30
- export declare enum ConstraintType {
28
+ /** Type of Constraint */
29
+ export declare enum PhysicsConstraintType {
30
+ /**
31
+ * A ball and socket constraint will attempt to line up the pivot
32
+ * positions in each body, and have no restrictions on rotation
33
+ */
31
34
  BALL_AND_SOCKET = 1,
35
+ /**
36
+ * A distance constraint will attempt to keep the pivot locations
37
+ * within a specified distance.
38
+ */
32
39
  DISTANCE = 2,
40
+ /**
41
+ * A hinge constraint will keep the pivot positions aligned as well
42
+ * as two angular axes. The remaining angular axis will be free to rotate.
43
+ */
33
44
  HINGE = 3,
45
+ /**
46
+ * A slider constraint allows bodies to translate along one axis and
47
+ * rotate about the same axis. The remaining two axes are locked in
48
+ * place
49
+ */
34
50
  SLIDER = 4,
51
+ /**
52
+ * A lock constraint will attempt to keep the pivots completely lined
53
+ * up between both bodies, allowing no relative movement.
54
+ */
35
55
  LOCK = 5,
36
- PRISMATIC = 6
56
+ PRISMATIC = 6,
57
+ SIX_DOF = 7
37
58
  }
38
- /** @internal */
39
- export declare enum ShapeType {
59
+ /** Type of Shape */
60
+ export declare enum PhysicsShapeType {
40
61
  SPHERE = 0,
41
62
  CAPSULE = 1,
42
63
  CYLINDER = 2,
@@ -46,8 +67,8 @@ export declare enum ShapeType {
46
67
  MESH = 6,
47
68
  HEIGHTFIELD = 7
48
69
  }
49
- /** @internal */
50
- export declare enum ConstraintMotorType {
70
+ /** Optional motor which attempts to move a body at a specific velocity, or at a specific position */
71
+ export declare enum PhysicsConstraintMotorType {
51
72
  NONE = 0,
52
73
  VELOCITY = 1,
53
74
  POSITION = 2
@@ -64,6 +85,14 @@ export interface IPhysicsCollisionEvent {
64
85
  * 2nd physics body that collided
65
86
  */
66
87
  collidedAgainst: PhysicsBody;
88
+ /**
89
+ * index in instances array for the collider
90
+ */
91
+ colliderIndex: number;
92
+ /**
93
+ * index in instances array for the collidedAgainst
94
+ */
95
+ collidedAgainstIndex: number;
67
96
  /**
68
97
  * World position where the collision occured
69
98
  */
@@ -81,7 +110,9 @@ export interface IPhysicsCollisionEvent {
81
110
  */
82
111
  normal: Nullable<Vector3>;
83
112
  }
84
- /** @internal */
113
+ /**
114
+ * Parameters used to describe the Shape
115
+ */
85
116
  export interface PhysicsShapeParameters {
86
117
  /**
87
118
  * Shape center position
@@ -100,7 +131,7 @@ export interface PhysicsShapeParameters {
100
131
  */
101
132
  pointB?: Vector3;
102
133
  /**
103
- *
134
+ * Shape orientation
104
135
  */
105
136
  rotation?: Quaternion;
106
137
  /**
@@ -116,38 +147,55 @@ export interface PhysicsShapeParameters {
116
147
  */
117
148
  includeChildMeshes?: boolean;
118
149
  }
119
- /** @internal */
150
+ /**
151
+ * Parameters used to describe a Constraint
152
+ */
120
153
  export interface PhysicsConstraintParameters {
121
154
  /**
122
- * Pivot vector for 1st body
155
+ * Location of the constraint pivot in the space of first body
123
156
  */
124
157
  pivotA?: Vector3;
125
158
  /**
126
- * Pivot vector for 2nd body
159
+ * Location of the constraint pivot in the space of the second body
127
160
  */
128
161
  pivotB?: Vector3;
129
162
  /**
130
- * Axis vector for 1st body
163
+ * An axis in the space of the first body which determines how
164
+ * distances/angles are measured for LINEAR_X/ANGULAR_X limits.
131
165
  */
132
166
  axisA?: Vector3;
133
167
  /**
134
- * Axis vector for 2nd body
168
+ * An axis in the space of the second body which determines how
169
+ * distances/angles are measured for LINEAR_X/ANGULAR_X limits.
135
170
  */
136
171
  axisB?: Vector3;
137
172
  /**
138
- * Maximum distance between both bodies
173
+ * An axis in the space of the first body which determines how
174
+ * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits.
175
+ */
176
+ perpAxisA?: Vector3;
177
+ /**
178
+ * An axis in the space of the second body which determines how
179
+ * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits.
180
+ */
181
+ perpAxisB?: Vector3;
182
+ /**
183
+ * The maximum distance that can seperate the two pivots.
184
+ * Only used for DISTANCE constraints
139
185
  */
140
186
  maxDistance?: number;
141
187
  /**
142
- * Can connected bodies collide?
188
+ * Determines if the connected bodies should collide. Generally,
189
+ * it is preferable to set this to false, especially if the constraint
190
+ * positions the bodies so that they overlap. Otherwise, the constraint
191
+ * will "fight" the collision detection and may cause jitter.
143
192
  */
144
193
  collision?: boolean;
145
194
  }
146
195
  /**
147
- *
196
+ * Parameters used to describe mass and inertia of the Physics Body
148
197
  */
149
- /** @internal */
150
- export interface MassProperties {
198
+ export interface PhysicsMassProperties {
151
199
  /**
152
200
  * The center of mass, in local space. This is The
153
201
  * point the body will rotate around when applying
@@ -190,6 +238,9 @@ export interface MassProperties {
190
238
  */
191
239
  inertiaOrientation?: Quaternion;
192
240
  }
241
+ /**
242
+ * Indicates how the body will behave.
243
+ */
193
244
  export declare enum PhysicsMotionType {
194
245
  STATIC = 0,
195
246
  ANIMATED = 1,
@@ -208,14 +259,7 @@ export interface IPhysicsEnginePluginV2 {
208
259
  /**
209
260
  * Collision observable
210
261
  */
211
- onCollisionObservable: Observable<{
212
- collider: PhysicsBody;
213
- collidedAgainst: PhysicsBody;
214
- point: Nullable<Vector3>;
215
- distance: number;
216
- impulse: number;
217
- normal: Nullable<Vector3>;
218
- }>;
262
+ onCollisionObservable: Observable<IPhysicsCollisionEvent>;
219
263
  setGravity(gravity: Vector3): void;
220
264
  setTimeStep(timeStep: number): void;
221
265
  getTimeStep(): number;
@@ -227,41 +271,40 @@ export interface IPhysicsEnginePluginV2 {
227
271
  removeBody(body: PhysicsBody): void;
228
272
  sync(body: PhysicsBody): void;
229
273
  syncTransform(body: PhysicsBody, transformNode: TransformNode): void;
230
- addNodeShape(body: PhysicsBody, shapeNode: TransformNode): void;
231
- setShape(body: PhysicsBody, shape: PhysicsShape): void;
232
- getShape(body: PhysicsBody): PhysicsShape;
233
- getShapeType(shape: PhysicsShape): ShapeType;
234
- setFilterGroup(body: PhysicsBody, group: number): void;
235
- getFilterGroup(body: PhysicsBody): number;
236
- setEventMask(body: PhysicsBody, eventMask: number): void;
237
- getEventMask(body: PhysicsBody): number;
238
- setMotionType(body: PhysicsBody, motionType: PhysicsMotionType): void;
239
- getMotionType(body: PhysicsBody): PhysicsMotionType;
240
- computeMassProperties(body: PhysicsBody): MassProperties;
241
- setMassProperties(body: PhysicsBody, massProps: MassProperties): void;
242
- getMassProperties(body: PhysicsBody): MassProperties;
243
- setLinearDamping(body: PhysicsBody, damping: number): void;
244
- getLinearDamping(body: PhysicsBody): number;
245
- setAngularDamping(body: PhysicsBody, damping: number): void;
246
- getAngularDamping(body: PhysicsBody): number;
247
- setLinearVelocity(body: PhysicsBody, linVel: Vector3): void;
248
- getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3): void;
249
- applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3): void;
250
- applyForce(body: PhysicsBody, force: Vector3, location: Vector3): void;
251
- setAngularVelocity(body: PhysicsBody, angVel: Vector3): void;
252
- getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3): void;
274
+ setShape(body: PhysicsBody, shape: Nullable<PhysicsShape>): void;
275
+ getShape(body: PhysicsBody): Nullable<PhysicsShape>;
276
+ getShapeType(shape: PhysicsShape): PhysicsShapeType;
277
+ setEventMask(body: PhysicsBody, eventMask: number, instanceIndex?: number): void;
278
+ getEventMask(body: PhysicsBody, instanceIndex?: number): number;
279
+ setMotionType(body: PhysicsBody, motionType: PhysicsMotionType, instanceIndex?: number): void;
280
+ getMotionType(body: PhysicsBody, instanceIndex?: number): PhysicsMotionType;
281
+ computeMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;
282
+ setMassProperties(body: PhysicsBody, massProps: PhysicsMassProperties, instanceIndex?: number): void;
283
+ getMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;
284
+ setLinearDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;
285
+ getLinearDamping(body: PhysicsBody, instanceIndex?: number): number;
286
+ setAngularDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;
287
+ getAngularDamping(body: PhysicsBody, instanceIndex?: number): number;
288
+ setLinearVelocity(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;
289
+ getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;
290
+ applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3, instanceIndex?: number): void;
291
+ applyForce(body: PhysicsBody, force: Vector3, location: Vector3, instanceIndex?: number): void;
292
+ setAngularVelocity(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;
293
+ getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;
253
294
  getBodyGeometry(body: PhysicsBody): {};
254
295
  disposeBody(body: PhysicsBody): void;
255
- setCollisionCallbackEnabled(body: PhysicsBody, enabled: boolean): void;
256
- addConstraint(body: PhysicsBody, childBody: PhysicsBody, constraint: PhysicsConstraint): void;
257
- getCollisionObservable(body: PhysicsBody): Observable<IPhysicsCollisionEvent>;
258
- initShape(shape: PhysicsShape, type: ShapeType, options: PhysicsShapeParameters): void;
259
- setFilterLayer(shape: PhysicsShape, layer: number): void;
260
- getFilterLayer(shape: PhysicsShape): number;
296
+ setCollisionCallbackEnabled(body: PhysicsBody, enabled: boolean, instanceIndex?: number): void;
297
+ addConstraint(body: PhysicsBody, childBody: PhysicsBody, constraint: PhysicsConstraint, instanceIndex?: number, childInstanceIndex?: number): void;
298
+ getCollisionObservable(body: PhysicsBody, instanceIndex?: number): Observable<IPhysicsCollisionEvent>;
299
+ initShape(shape: PhysicsShape, type: PhysicsShapeType, options: PhysicsShapeParameters): void;
300
+ setShapeFilterMembershipMask(shape: PhysicsShape, membershipMask: number): void;
301
+ getShapeFilterMembershipMask(shape: PhysicsShape): number;
302
+ setShapeFilterCollideMask(shape: PhysicsShape, collideMask: number): void;
303
+ getShapeFilterCollideMask(shape: PhysicsShape): number;
261
304
  setMaterial(shape: PhysicsShape, material: PhysicsMaterial): void;
262
305
  setDensity(shape: PhysicsShape, density: number): void;
263
306
  getDensity(shape: PhysicsShape): number;
264
- addChild(shape: PhysicsShape, newChild: PhysicsShape, childTransform: TransformNode): void;
307
+ addChild(shape: PhysicsShape, newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void;
265
308
  removeChild(shape: PhysicsShape, childIndex: number): void;
266
309
  getNumChildren(shape: PhysicsShape): number;
267
310
  getBoundingBox(shape: PhysicsShape): BoundingBox;
@@ -271,20 +314,20 @@ export interface IPhysicsEnginePluginV2 {
271
314
  getEnabled(constraint: PhysicsConstraint): boolean;
272
315
  setCollisionsEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;
273
316
  getCollisionsEnabled(constraint: PhysicsConstraint): boolean;
274
- setAxisFriction(constraint: PhysicsConstraint, axis: ConstraintAxis, friction: number): void;
275
- getAxisFriction(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
276
- setAxisMode(constraint: PhysicsConstraint, axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void;
277
- getAxisMode(constraint: PhysicsConstraint, axis: ConstraintAxis): ConstraintAxisLimitMode;
278
- setAxisMinLimit(constraint: PhysicsConstraint, axis: ConstraintAxis, minLimit: number): void;
279
- getAxisMinLimit(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
280
- setAxisMaxLimit(constraint: PhysicsConstraint, axis: ConstraintAxis, limit: number): void;
281
- getAxisMaxLimit(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
282
- setAxisMotorType(constraint: PhysicsConstraint, axis: ConstraintAxis, motorType: ConstraintMotorType): void;
283
- getAxisMotorType(constraint: PhysicsConstraint, axis: ConstraintAxis): ConstraintMotorType;
284
- setAxisMotorTarget(constraint: PhysicsConstraint, axis: ConstraintAxis, target: number): void;
285
- getAxisMotorTarget(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
286
- setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: ConstraintAxis, maxForce: number): void;
287
- getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
317
+ setAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, friction: number): void;
318
+ getAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
319
+ setAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void;
320
+ getAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): PhysicsConstraintAxisLimitMode;
321
+ setAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, minLimit: number): void;
322
+ getAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
323
+ setAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limit: number): void;
324
+ getAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
325
+ setAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void;
326
+ getAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): PhysicsConstraintMotorType;
327
+ setAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, target: number): void;
328
+ getAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
329
+ setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, maxForce: number): void;
330
+ getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
288
331
  disposeConstraint(constraint: PhysicsConstraint): void;
289
332
  raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;
290
333
  dispose(): void;
@@ -1,51 +1,122 @@
1
- /** @internal */
2
- export var ConstraintAxisLimitMode;
3
- (function (ConstraintAxisLimitMode) {
4
- ConstraintAxisLimitMode[ConstraintAxisLimitMode["FREE"] = 0] = "FREE";
5
- ConstraintAxisLimitMode[ConstraintAxisLimitMode["LIMITED"] = 1] = "LIMITED";
6
- ConstraintAxisLimitMode[ConstraintAxisLimitMode["LOCKED"] = 2] = "LOCKED";
7
- ConstraintAxisLimitMode[ConstraintAxisLimitMode["NONE"] = 3] = "NONE";
8
- })(ConstraintAxisLimitMode || (ConstraintAxisLimitMode = {}));
9
- /** @internal */
10
- export var ConstraintAxis;
11
- (function (ConstraintAxis) {
12
- ConstraintAxis[ConstraintAxis["LINEAR_X"] = 0] = "LINEAR_X";
13
- ConstraintAxis[ConstraintAxis["LINEAR_Y"] = 1] = "LINEAR_Y";
14
- ConstraintAxis[ConstraintAxis["LINEAR_Z"] = 2] = "LINEAR_Z";
15
- ConstraintAxis[ConstraintAxis["ANGULAR_X"] = 3] = "ANGULAR_X";
16
- ConstraintAxis[ConstraintAxis["ANGULAR_Y"] = 4] = "ANGULAR_Y";
17
- ConstraintAxis[ConstraintAxis["ANGULAR_Z"] = 5] = "ANGULAR_Z";
18
- ConstraintAxis[ConstraintAxis["LINEAR_DISTANCE"] = 6] = "LINEAR_DISTANCE";
19
- })(ConstraintAxis || (ConstraintAxis = {}));
20
- /** @internal */
21
- export var ConstraintType;
22
- (function (ConstraintType) {
23
- ConstraintType[ConstraintType["BALL_AND_SOCKET"] = 1] = "BALL_AND_SOCKET";
24
- ConstraintType[ConstraintType["DISTANCE"] = 2] = "DISTANCE";
25
- ConstraintType[ConstraintType["HINGE"] = 3] = "HINGE";
26
- ConstraintType[ConstraintType["SLIDER"] = 4] = "SLIDER";
27
- ConstraintType[ConstraintType["LOCK"] = 5] = "LOCK";
28
- ConstraintType[ConstraintType["PRISMATIC"] = 6] = "PRISMATIC";
29
- })(ConstraintType || (ConstraintType = {}));
30
- /** @internal */
31
- export var ShapeType;
32
- (function (ShapeType) {
33
- ShapeType[ShapeType["SPHERE"] = 0] = "SPHERE";
34
- ShapeType[ShapeType["CAPSULE"] = 1] = "CAPSULE";
35
- ShapeType[ShapeType["CYLINDER"] = 2] = "CYLINDER";
36
- ShapeType[ShapeType["BOX"] = 3] = "BOX";
37
- ShapeType[ShapeType["CONVEX_HULL"] = 4] = "CONVEX_HULL";
38
- ShapeType[ShapeType["CONTAINER"] = 5] = "CONTAINER";
39
- ShapeType[ShapeType["MESH"] = 6] = "MESH";
40
- ShapeType[ShapeType["HEIGHTFIELD"] = 7] = "HEIGHTFIELD";
41
- })(ShapeType || (ShapeType = {}));
42
- /** @internal */
43
- export var ConstraintMotorType;
44
- (function (ConstraintMotorType) {
45
- ConstraintMotorType[ConstraintMotorType["NONE"] = 0] = "NONE";
46
- ConstraintMotorType[ConstraintMotorType["VELOCITY"] = 1] = "VELOCITY";
47
- ConstraintMotorType[ConstraintMotorType["POSITION"] = 2] = "POSITION";
48
- })(ConstraintMotorType || (ConstraintMotorType = {}));
1
+ /** How a specific axis can be constrained */
2
+ export var PhysicsConstraintAxisLimitMode;
3
+ (function (PhysicsConstraintAxisLimitMode) {
4
+ /*
5
+ * The axis is not restricted at all
6
+ */
7
+ PhysicsConstraintAxisLimitMode[PhysicsConstraintAxisLimitMode["FREE"] = 0] = "FREE";
8
+ /*
9
+ * The axis has a minimum/maximum limit
10
+ */
11
+ PhysicsConstraintAxisLimitMode[PhysicsConstraintAxisLimitMode["LIMITED"] = 1] = "LIMITED";
12
+ /*
13
+ * The axis allows no relative movement of the pivots
14
+ */
15
+ PhysicsConstraintAxisLimitMode[PhysicsConstraintAxisLimitMode["LOCKED"] = 2] = "LOCKED";
16
+ })(PhysicsConstraintAxisLimitMode || (PhysicsConstraintAxisLimitMode = {}));
17
+ /** The constraint specific axis to use when setting Friction, `ConstraintAxisLimitMode`, max force, ... */
18
+ export var PhysicsConstraintAxis;
19
+ (function (PhysicsConstraintAxis) {
20
+ /*
21
+ * Translation along the primary axis of the constraint (i.e. the
22
+ * direction specified by PhysicsConstraintParameters.axisA/axisB)
23
+ */
24
+ PhysicsConstraintAxis[PhysicsConstraintAxis["LINEAR_X"] = 0] = "LINEAR_X";
25
+ /*
26
+ * Translation along the second axis of the constraint (i.e. the
27
+ * direction specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)
28
+ */
29
+ PhysicsConstraintAxis[PhysicsConstraintAxis["LINEAR_Y"] = 1] = "LINEAR_Y";
30
+ /*
31
+ * Translation along the third axis of the constraint. This axis is
32
+ * computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)
33
+ */
34
+ PhysicsConstraintAxis[PhysicsConstraintAxis["LINEAR_Z"] = 2] = "LINEAR_Z";
35
+ /*
36
+ * Rotation around the primary axis of the constraint (i.e. the
37
+ * axis specified by PhysicsConstraintParameters.axisA/axisB)
38
+ */
39
+ PhysicsConstraintAxis[PhysicsConstraintAxis["ANGULAR_X"] = 3] = "ANGULAR_X";
40
+ /*
41
+ * Rotation around the second axis of the constraint (i.e. the
42
+ * axis specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)
43
+ */
44
+ PhysicsConstraintAxis[PhysicsConstraintAxis["ANGULAR_Y"] = 4] = "ANGULAR_Y";
45
+ /*
46
+ * Rotation around the third axis of the constraint. This axis is
47
+ * computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)
48
+ */
49
+ PhysicsConstraintAxis[PhysicsConstraintAxis["ANGULAR_Z"] = 5] = "ANGULAR_Z";
50
+ /*
51
+ * A 3D distance limit; similar to specifying the LINEAR_X/Y/Z axes
52
+ * individually, but the distance calculation uses all three axes
53
+ * simultaneously, instead of individually.
54
+ */
55
+ PhysicsConstraintAxis[PhysicsConstraintAxis["LINEAR_DISTANCE"] = 6] = "LINEAR_DISTANCE";
56
+ })(PhysicsConstraintAxis || (PhysicsConstraintAxis = {}));
57
+ /** Type of Constraint */
58
+ export var PhysicsConstraintType;
59
+ (function (PhysicsConstraintType) {
60
+ /**
61
+ * A ball and socket constraint will attempt to line up the pivot
62
+ * positions in each body, and have no restrictions on rotation
63
+ */
64
+ PhysicsConstraintType[PhysicsConstraintType["BALL_AND_SOCKET"] = 1] = "BALL_AND_SOCKET";
65
+ /**
66
+ * A distance constraint will attempt to keep the pivot locations
67
+ * within a specified distance.
68
+ */
69
+ PhysicsConstraintType[PhysicsConstraintType["DISTANCE"] = 2] = "DISTANCE";
70
+ /**
71
+ * A hinge constraint will keep the pivot positions aligned as well
72
+ * as two angular axes. The remaining angular axis will be free to rotate.
73
+ */
74
+ PhysicsConstraintType[PhysicsConstraintType["HINGE"] = 3] = "HINGE";
75
+ /**
76
+ * A slider constraint allows bodies to translate along one axis and
77
+ * rotate about the same axis. The remaining two axes are locked in
78
+ * place
79
+ */
80
+ PhysicsConstraintType[PhysicsConstraintType["SLIDER"] = 4] = "SLIDER";
81
+ /**
82
+ * A lock constraint will attempt to keep the pivots completely lined
83
+ * up between both bodies, allowing no relative movement.
84
+ */
85
+ PhysicsConstraintType[PhysicsConstraintType["LOCK"] = 5] = "LOCK";
86
+ /*
87
+ * A prismatic will lock the rotations of the bodies, and allow translation
88
+ * only along one axis
89
+ */
90
+ PhysicsConstraintType[PhysicsConstraintType["PRISMATIC"] = 6] = "PRISMATIC";
91
+ /*
92
+ * A generic constraint; this starts with no limits on how the bodies can
93
+ * move relative to each other, but limits can be added via the PhysicsConstraint
94
+ * interfaces. This can be used to specify a large variety of constraints
95
+ */
96
+ PhysicsConstraintType[PhysicsConstraintType["SIX_DOF"] = 7] = "SIX_DOF";
97
+ })(PhysicsConstraintType || (PhysicsConstraintType = {}));
98
+ /** Type of Shape */
99
+ export var PhysicsShapeType;
100
+ (function (PhysicsShapeType) {
101
+ PhysicsShapeType[PhysicsShapeType["SPHERE"] = 0] = "SPHERE";
102
+ PhysicsShapeType[PhysicsShapeType["CAPSULE"] = 1] = "CAPSULE";
103
+ PhysicsShapeType[PhysicsShapeType["CYLINDER"] = 2] = "CYLINDER";
104
+ PhysicsShapeType[PhysicsShapeType["BOX"] = 3] = "BOX";
105
+ PhysicsShapeType[PhysicsShapeType["CONVEX_HULL"] = 4] = "CONVEX_HULL";
106
+ PhysicsShapeType[PhysicsShapeType["CONTAINER"] = 5] = "CONTAINER";
107
+ PhysicsShapeType[PhysicsShapeType["MESH"] = 6] = "MESH";
108
+ PhysicsShapeType[PhysicsShapeType["HEIGHTFIELD"] = 7] = "HEIGHTFIELD";
109
+ })(PhysicsShapeType || (PhysicsShapeType = {}));
110
+ /** Optional motor which attempts to move a body at a specific velocity, or at a specific position */
111
+ export var PhysicsConstraintMotorType;
112
+ (function (PhysicsConstraintMotorType) {
113
+ PhysicsConstraintMotorType[PhysicsConstraintMotorType["NONE"] = 0] = "NONE";
114
+ PhysicsConstraintMotorType[PhysicsConstraintMotorType["VELOCITY"] = 1] = "VELOCITY";
115
+ PhysicsConstraintMotorType[PhysicsConstraintMotorType["POSITION"] = 2] = "POSITION";
116
+ })(PhysicsConstraintMotorType || (PhysicsConstraintMotorType = {}));
117
+ /**
118
+ * Indicates how the body will behave.
119
+ */
49
120
  export var PhysicsMotionType;
50
121
  (function (PhysicsMotionType) {
51
122
  PhysicsMotionType[PhysicsMotionType["STATIC"] = 0] = "STATIC";
@@ -1 +1 @@
1
- {"version":3,"file":"IPhysicsEnginePlugin.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/IPhysicsEnginePlugin.ts"],"names":[],"mappings":"AAYA,gBAAgB;AAChB,MAAM,CAAN,IAAY,uBAKX;AALD,WAAY,uBAAuB;IAC/B,qEAAI,CAAA;IACJ,2EAAO,CAAA;IACP,yEAAM,CAAA;IACN,qEAAI,CAAA;AACR,CAAC,EALW,uBAAuB,KAAvB,uBAAuB,QAKlC;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACtB,2DAAQ,CAAA;IACR,2DAAQ,CAAA;IACR,2DAAQ,CAAA;IACR,6DAAS,CAAA;IACT,6DAAS,CAAA;IACT,6DAAS,CAAA;IACT,yEAAe,CAAA;AACnB,CAAC,EARW,cAAc,KAAd,cAAc,QAQzB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACtB,yEAAmB,CAAA;IACnB,2DAAY,CAAA;IACZ,qDAAS,CAAA;IACT,uDAAU,CAAA;IACV,mDAAQ,CAAA;IACR,6DAAa,CAAA;AACjB,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,SASX;AATD,WAAY,SAAS;IACjB,6CAAM,CAAA;IACN,+CAAO,CAAA;IACP,iDAAQ,CAAA;IACR,uCAAG,CAAA;IACH,uDAAW,CAAA;IACX,mDAAS,CAAA;IACT,yCAAI,CAAA;IACJ,uDAAW,CAAA;AACf,CAAC,EATW,SAAS,KAAT,SAAS,QASpB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,6DAAI,CAAA;IACJ,qEAAQ,CAAA;IACR,qEAAQ,CAAA;AACZ,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B;AAgJD,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,6DAAM,CAAA;IACN,iEAAQ,CAAA;IACR,+DAAO,CAAA;AACX,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B","sourcesContent":["import type { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\nimport type { PhysicsShape } from \"./physicsShape\";\r\nimport type { PhysicsConstraint } from \"./physicsConstraint\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\n/** @internal */\r\nexport enum ConstraintAxisLimitMode {\r\n FREE,\r\n LIMITED,\r\n LOCKED,\r\n NONE,\r\n}\r\n\r\n/** @internal */\r\nexport enum ConstraintAxis {\r\n LINEAR_X,\r\n LINEAR_Y,\r\n LINEAR_Z,\r\n ANGULAR_X,\r\n ANGULAR_Y,\r\n ANGULAR_Z,\r\n LINEAR_DISTANCE,\r\n}\r\n\r\n/** @internal */\r\nexport enum ConstraintType {\r\n BALL_AND_SOCKET = 1,\r\n DISTANCE = 2,\r\n HINGE = 3,\r\n SLIDER = 4,\r\n LOCK = 5,\r\n PRISMATIC = 6,\r\n}\r\n\r\n/** @internal */\r\nexport enum ShapeType {\r\n SPHERE,\r\n CAPSULE,\r\n CYLINDER,\r\n BOX,\r\n CONVEX_HULL,\r\n CONTAINER,\r\n MESH,\r\n HEIGHTFIELD,\r\n}\r\n\r\n/** @internal */\r\nexport enum ConstraintMotorType {\r\n NONE,\r\n VELOCITY,\r\n POSITION,\r\n}\r\n\r\n/**\r\n * Collision object that is the parameter when notification for collision fires.\r\n */\r\nexport interface IPhysicsCollisionEvent {\r\n /**\r\n * 1st physics body that collided\r\n */\r\n collider: PhysicsBody;\r\n /**\r\n * 2nd physics body that collided\r\n */\r\n collidedAgainst: PhysicsBody;\r\n /**\r\n * World position where the collision occured\r\n */\r\n point: Nullable<Vector3>;\r\n /**\r\n * Penetration distance\r\n */\r\n distance: number;\r\n /**\r\n * Impulse value computed by the solver response\r\n */\r\n impulse: number;\r\n /**\r\n * Collision world normal direction\r\n */\r\n normal: Nullable<Vector3>;\r\n}\r\n\r\n/** @internal */\r\nexport interface PhysicsShapeParameters {\r\n /**\r\n * Shape center position\r\n */\r\n center?: Vector3;\r\n /**\r\n * Radius for cylinder, shape and capsule\r\n */\r\n radius?: number;\r\n /**\r\n * First point position that defines the cylinder or capsule\r\n */\r\n pointA?: Vector3;\r\n /**\r\n * Second point position that defines the cylinder or capsule\r\n */\r\n pointB?: Vector3;\r\n /**\r\n *\r\n */\r\n rotation?: Quaternion;\r\n /**\r\n * Dimesion extention for the box\r\n */\r\n extents?: Vector3;\r\n /**\r\n * Mesh used for Mesh shape or convex hull. It can be different than the mesh the body is attached to.\r\n */\r\n mesh?: Mesh;\r\n /**\r\n * Use children hierarchy\r\n */\r\n includeChildMeshes?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport interface PhysicsConstraintParameters {\r\n /**\r\n * Pivot vector for 1st body\r\n */\r\n pivotA?: Vector3;\r\n /**\r\n * Pivot vector for 2nd body\r\n */\r\n pivotB?: Vector3;\r\n /**\r\n * Axis vector for 1st body\r\n */\r\n axisA?: Vector3;\r\n /**\r\n * Axis vector for 2nd body\r\n */\r\n axisB?: Vector3;\r\n /**\r\n * Maximum distance between both bodies\r\n */\r\n maxDistance?: number;\r\n /**\r\n * Can connected bodies collide?\r\n */\r\n collision?: boolean;\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport interface MassProperties {\r\n /**\r\n * The center of mass, in local space. This is The\r\n * point the body will rotate around when applying\r\n * an angular velocity.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n centerOfMass?: Vector3;\r\n /**\r\n * The total mass of this object, in kilograms. This\r\n * affects how easy it is to move the body. A value\r\n * of zero will be used as an infinite mass.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n mass?: number;\r\n /**\r\n * The principal moments of inertia of this object\r\n * for a unit mass. This determines how easy it is\r\n * for the body to rotate. A value of zero on any\r\n * axis will be used as infinite interia about that\r\n * axis.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n inertia?: Vector3;\r\n /**\r\n * The rotation rotating from inertia major axis space\r\n * to parent space (i.e., the rotation which, when\r\n * applied to the 3x3 inertia tensor causes the inertia\r\n * tensor to become a diagonal matrix). This determines\r\n * how the values of inertia are aligned with the parent\r\n * object.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n inertiaOrientation?: Quaternion;\r\n}\r\n\r\nexport enum PhysicsMotionType {\r\n STATIC,\r\n ANIMATED,\r\n DYNAMIC,\r\n}\r\n\r\n/** @internal */\r\nexport interface IPhysicsEnginePluginV2 {\r\n /**\r\n * Physics plugin world instance\r\n */\r\n world: any;\r\n /**\r\n * Physics plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Collision observable\r\n */\r\n onCollisionObservable: Observable<{\r\n collider: PhysicsBody;\r\n collidedAgainst: PhysicsBody;\r\n point: Nullable<Vector3>;\r\n distance: number;\r\n impulse: number;\r\n normal: Nullable<Vector3>;\r\n }>;\r\n\r\n setGravity(gravity: Vector3): void;\r\n setTimeStep(timeStep: number): void;\r\n getTimeStep(): number;\r\n executeStep(delta: number, bodies: Array<PhysicsBody>): void; //not forgetting pre and post events\r\n getPluginVersion(): number;\r\n\r\n // body\r\n initBody(body: PhysicsBody, motionType: PhysicsMotionType, position: Vector3, orientation: Quaternion): void;\r\n initBodyInstances(body: PhysicsBody, motionType: PhysicsMotionType, mesh: Mesh): void;\r\n updateBodyInstances(body: PhysicsBody, mesh: Mesh): void;\r\n removeBody(body: PhysicsBody): void;\r\n sync(body: PhysicsBody): void;\r\n syncTransform(body: PhysicsBody, transformNode: TransformNode): void;\r\n addNodeShape(body: PhysicsBody, shapeNode: TransformNode): void;\r\n setShape(body: PhysicsBody, shape: PhysicsShape): void;\r\n getShape(body: PhysicsBody): PhysicsShape;\r\n getShapeType(shape: PhysicsShape): ShapeType;\r\n setFilterGroup(body: PhysicsBody, group: number): void;\r\n getFilterGroup(body: PhysicsBody): number;\r\n setEventMask(body: PhysicsBody, eventMask: number): void;\r\n getEventMask(body: PhysicsBody): number;\r\n setMotionType(body: PhysicsBody, motionType: PhysicsMotionType): void;\r\n getMotionType(body: PhysicsBody): PhysicsMotionType;\r\n computeMassProperties(body: PhysicsBody): MassProperties;\r\n setMassProperties(body: PhysicsBody, massProps: MassProperties): void;\r\n getMassProperties(body: PhysicsBody): MassProperties;\r\n setLinearDamping(body: PhysicsBody, damping: number): void;\r\n getLinearDamping(body: PhysicsBody): number;\r\n setAngularDamping(body: PhysicsBody, damping: number): void;\r\n getAngularDamping(body: PhysicsBody): number;\r\n setLinearVelocity(body: PhysicsBody, linVel: Vector3): void;\r\n getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3): void;\r\n applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3): void;\r\n applyForce(body: PhysicsBody, force: Vector3, location: Vector3): void;\r\n setAngularVelocity(body: PhysicsBody, angVel: Vector3): void;\r\n getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3): void;\r\n getBodyGeometry(body: PhysicsBody): {};\r\n disposeBody(body: PhysicsBody): void;\r\n setCollisionCallbackEnabled(body: PhysicsBody, enabled: boolean): void;\r\n addConstraint(body: PhysicsBody, childBody: PhysicsBody, constraint: PhysicsConstraint): void;\r\n getCollisionObservable(body: PhysicsBody): Observable<IPhysicsCollisionEvent>;\r\n\r\n // shape\r\n initShape(shape: PhysicsShape, type: ShapeType, options: PhysicsShapeParameters): void;\r\n setFilterLayer(shape: PhysicsShape, layer: number): void;\r\n getFilterLayer(shape: PhysicsShape): number;\r\n setMaterial(shape: PhysicsShape, material: PhysicsMaterial): void;\r\n setDensity(shape: PhysicsShape, density: number): void;\r\n getDensity(shape: PhysicsShape): number;\r\n addChild(shape: PhysicsShape, newChild: PhysicsShape, childTransform: TransformNode): void;\r\n removeChild(shape: PhysicsShape, childIndex: number): void;\r\n getNumChildren(shape: PhysicsShape): number;\r\n getBoundingBox(shape: PhysicsShape): BoundingBox;\r\n disposeShape(shape: PhysicsShape): void;\r\n\r\n // constraint\r\n initConstraint(constraint: PhysicsConstraint, body: PhysicsBody, childBody: PhysicsBody): void;\r\n setEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getEnabled(constraint: PhysicsConstraint): boolean;\r\n setCollisionsEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getCollisionsEnabled(constraint: PhysicsConstraint): boolean;\r\n setAxisFriction(constraint: PhysicsConstraint, axis: ConstraintAxis, friction: number): void;\r\n getAxisFriction(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n setAxisMode(constraint: PhysicsConstraint, axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void;\r\n getAxisMode(constraint: PhysicsConstraint, axis: ConstraintAxis): ConstraintAxisLimitMode;\r\n setAxisMinLimit(constraint: PhysicsConstraint, axis: ConstraintAxis, minLimit: number): void;\r\n getAxisMinLimit(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n setAxisMaxLimit(constraint: PhysicsConstraint, axis: ConstraintAxis, limit: number): void;\r\n getAxisMaxLimit(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n setAxisMotorType(constraint: PhysicsConstraint, axis: ConstraintAxis, motorType: ConstraintMotorType): void;\r\n getAxisMotorType(constraint: PhysicsConstraint, axis: ConstraintAxis): ConstraintMotorType;\r\n setAxisMotorTarget(constraint: PhysicsConstraint, axis: ConstraintAxis, target: number): void;\r\n getAxisMotorTarget(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: ConstraintAxis, maxForce: number): void;\r\n getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n disposeConstraint(constraint: PhysicsConstraint): void;\r\n\r\n // raycast\r\n raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;\r\n\r\n dispose(): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"IPhysicsEnginePlugin.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/IPhysicsEnginePlugin.ts"],"names":[],"mappings":"AAYA,6CAA6C;AAC7C,MAAM,CAAN,IAAY,8BAaX;AAbD,WAAY,8BAA8B;IACtC;;OAEG;IACH,mFAAI,CAAA;IACJ;;OAEG;IACH,yFAAO,CAAA;IACP;;OAEG;IACH,uFAAM,CAAA;AACV,CAAC,EAbW,8BAA8B,KAA9B,8BAA8B,QAazC;AAED,2GAA2G;AAC3G,MAAM,CAAN,IAAY,qBAqCX;AArCD,WAAY,qBAAqB;IAC7B;;;OAGG;IACH,yEAAQ,CAAA;IACR;;;OAGG;IACH,yEAAQ,CAAA;IACR;;;OAGG;IACH,yEAAQ,CAAA;IACR;;;OAGG;IACH,2EAAS,CAAA;IACT;;;OAGG;IACH,2EAAS,CAAA;IACT;;;OAGG;IACH,2EAAS,CAAA;IACT;;;;OAIG;IACH,uFAAe,CAAA;AACnB,CAAC,EArCW,qBAAqB,KAArB,qBAAqB,QAqChC;AAED,yBAAyB;AACzB,MAAM,CAAN,IAAY,qBAsCX;AAtCD,WAAY,qBAAqB;IAC7B;;;OAGG;IACH,uFAAmB,CAAA;IACnB;;;OAGG;IACH,yEAAY,CAAA;IACZ;;;OAGG;IACH,mEAAS,CAAA;IACT;;;;OAIG;IACH,qEAAU,CAAA;IACV;;;OAGG;IACH,iEAAQ,CAAA;IACR;;;OAGG;IACH,2EAAa,CAAA;IACb;;;;OAIG;IACH,uEAAW,CAAA;AACf,CAAC,EAtCW,qBAAqB,KAArB,qBAAqB,QAsChC;AAED,oBAAoB;AACpB,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IACxB,2DAAM,CAAA;IACN,6DAAO,CAAA;IACP,+DAAQ,CAAA;IACR,qDAAG,CAAA;IACH,qEAAW,CAAA;IACX,iEAAS,CAAA;IACT,uDAAI,CAAA;IACJ,qEAAW,CAAA;AACf,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAED,qGAAqG;AACrG,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,2EAAI,CAAA;IACJ,mFAAQ,CAAA;IACR,mFAAQ,CAAA;AACZ,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AA+KD;;GAEG;AACH,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,6DAAM,CAAA;IACN,iEAAQ,CAAA;IACR,+DAAO,CAAA;AACX,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B","sourcesContent":["import type { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\nimport type { PhysicsShape } from \"./physicsShape\";\r\nimport type { PhysicsConstraint } from \"./physicsConstraint\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\n/** How a specific axis can be constrained */\r\nexport enum PhysicsConstraintAxisLimitMode {\r\n /*\r\n * The axis is not restricted at all\r\n */\r\n FREE,\r\n /*\r\n * The axis has a minimum/maximum limit\r\n */\r\n LIMITED,\r\n /*\r\n * The axis allows no relative movement of the pivots\r\n */\r\n LOCKED,\r\n}\r\n\r\n/** The constraint specific axis to use when setting Friction, `ConstraintAxisLimitMode`, max force, ... */\r\nexport enum PhysicsConstraintAxis {\r\n /*\r\n * Translation along the primary axis of the constraint (i.e. the\r\n * direction specified by PhysicsConstraintParameters.axisA/axisB)\r\n */\r\n LINEAR_X,\r\n /*\r\n * Translation along the second axis of the constraint (i.e. the\r\n * direction specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)\r\n */\r\n LINEAR_Y,\r\n /*\r\n * Translation along the third axis of the constraint. This axis is\r\n * computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)\r\n */\r\n LINEAR_Z,\r\n /*\r\n * Rotation around the primary axis of the constraint (i.e. the\r\n * axis specified by PhysicsConstraintParameters.axisA/axisB)\r\n */\r\n ANGULAR_X,\r\n /*\r\n * Rotation around the second axis of the constraint (i.e. the\r\n * axis specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)\r\n */\r\n ANGULAR_Y,\r\n /*\r\n * Rotation around the third axis of the constraint. This axis is\r\n * computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)\r\n */\r\n ANGULAR_Z,\r\n /*\r\n * A 3D distance limit; similar to specifying the LINEAR_X/Y/Z axes\r\n * individually, but the distance calculation uses all three axes\r\n * simultaneously, instead of individually.\r\n */\r\n LINEAR_DISTANCE,\r\n}\r\n\r\n/** Type of Constraint */\r\nexport enum PhysicsConstraintType {\r\n /**\r\n * A ball and socket constraint will attempt to line up the pivot\r\n * positions in each body, and have no restrictions on rotation\r\n */\r\n BALL_AND_SOCKET = 1,\r\n /**\r\n * A distance constraint will attempt to keep the pivot locations\r\n * within a specified distance.\r\n */\r\n DISTANCE = 2,\r\n /**\r\n * A hinge constraint will keep the pivot positions aligned as well\r\n * as two angular axes. The remaining angular axis will be free to rotate.\r\n */\r\n HINGE = 3,\r\n /**\r\n * A slider constraint allows bodies to translate along one axis and\r\n * rotate about the same axis. The remaining two axes are locked in\r\n * place\r\n */\r\n SLIDER = 4,\r\n /**\r\n * A lock constraint will attempt to keep the pivots completely lined\r\n * up between both bodies, allowing no relative movement.\r\n */\r\n LOCK = 5,\r\n /*\r\n * A prismatic will lock the rotations of the bodies, and allow translation\r\n * only along one axis\r\n */\r\n PRISMATIC = 6,\r\n /*\r\n * A generic constraint; this starts with no limits on how the bodies can\r\n * move relative to each other, but limits can be added via the PhysicsConstraint\r\n * interfaces. This can be used to specify a large variety of constraints\r\n */\r\n SIX_DOF = 7,\r\n}\r\n\r\n/** Type of Shape */\r\nexport enum PhysicsShapeType {\r\n SPHERE,\r\n CAPSULE,\r\n CYLINDER,\r\n BOX,\r\n CONVEX_HULL,\r\n CONTAINER,\r\n MESH,\r\n HEIGHTFIELD,\r\n}\r\n\r\n/** Optional motor which attempts to move a body at a specific velocity, or at a specific position */\r\nexport enum PhysicsConstraintMotorType {\r\n NONE,\r\n VELOCITY,\r\n POSITION,\r\n}\r\n\r\n/**\r\n * Collision object that is the parameter when notification for collision fires.\r\n */\r\nexport interface IPhysicsCollisionEvent {\r\n /**\r\n * 1st physics body that collided\r\n */\r\n collider: PhysicsBody;\r\n /**\r\n * 2nd physics body that collided\r\n */\r\n collidedAgainst: PhysicsBody;\r\n /**\r\n * index in instances array for the collider\r\n */\r\n colliderIndex: number;\r\n /**\r\n * index in instances array for the collidedAgainst\r\n */\r\n collidedAgainstIndex: number;\r\n /**\r\n * World position where the collision occured\r\n */\r\n point: Nullable<Vector3>;\r\n /**\r\n * Penetration distance\r\n */\r\n distance: number;\r\n /**\r\n * Impulse value computed by the solver response\r\n */\r\n impulse: number;\r\n /**\r\n * Collision world normal direction\r\n */\r\n normal: Nullable<Vector3>;\r\n}\r\n\r\n/**\r\n * Parameters used to describe the Shape\r\n */\r\nexport interface PhysicsShapeParameters {\r\n /**\r\n * Shape center position\r\n */\r\n center?: Vector3;\r\n /**\r\n * Radius for cylinder, shape and capsule\r\n */\r\n radius?: number;\r\n /**\r\n * First point position that defines the cylinder or capsule\r\n */\r\n pointA?: Vector3;\r\n /**\r\n * Second point position that defines the cylinder or capsule\r\n */\r\n pointB?: Vector3;\r\n /**\r\n * Shape orientation\r\n */\r\n rotation?: Quaternion;\r\n /**\r\n * Dimesion extention for the box\r\n */\r\n extents?: Vector3;\r\n /**\r\n * Mesh used for Mesh shape or convex hull. It can be different than the mesh the body is attached to.\r\n */\r\n mesh?: Mesh;\r\n /**\r\n * Use children hierarchy\r\n */\r\n includeChildMeshes?: boolean;\r\n}\r\n\r\n/**\r\n * Parameters used to describe a Constraint\r\n */\r\nexport interface PhysicsConstraintParameters {\r\n /**\r\n * Location of the constraint pivot in the space of first body\r\n */\r\n pivotA?: Vector3;\r\n /**\r\n * Location of the constraint pivot in the space of the second body\r\n */\r\n pivotB?: Vector3;\r\n /**\r\n * An axis in the space of the first body which determines how\r\n * distances/angles are measured for LINEAR_X/ANGULAR_X limits.\r\n */\r\n axisA?: Vector3;\r\n /**\r\n * An axis in the space of the second body which determines how\r\n * distances/angles are measured for LINEAR_X/ANGULAR_X limits.\r\n */\r\n axisB?: Vector3;\r\n\r\n /**\r\n * An axis in the space of the first body which determines how\r\n * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits.\r\n */\r\n perpAxisA?: Vector3;\r\n\r\n /**\r\n * An axis in the space of the second body which determines how\r\n * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits.\r\n */\r\n perpAxisB?: Vector3;\r\n\r\n /**\r\n * The maximum distance that can seperate the two pivots.\r\n * Only used for DISTANCE constraints\r\n */\r\n maxDistance?: number;\r\n\r\n /**\r\n * Determines if the connected bodies should collide. Generally,\r\n * it is preferable to set this to false, especially if the constraint\r\n * positions the bodies so that they overlap. Otherwise, the constraint\r\n * will \"fight\" the collision detection and may cause jitter.\r\n */\r\n collision?: boolean;\r\n}\r\n\r\n/**\r\n * Parameters used to describe mass and inertia of the Physics Body\r\n */\r\nexport interface PhysicsMassProperties {\r\n /**\r\n * The center of mass, in local space. This is The\r\n * point the body will rotate around when applying\r\n * an angular velocity.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n centerOfMass?: Vector3;\r\n /**\r\n * The total mass of this object, in kilograms. This\r\n * affects how easy it is to move the body. A value\r\n * of zero will be used as an infinite mass.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n mass?: number;\r\n /**\r\n * The principal moments of inertia of this object\r\n * for a unit mass. This determines how easy it is\r\n * for the body to rotate. A value of zero on any\r\n * axis will be used as infinite interia about that\r\n * axis.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n inertia?: Vector3;\r\n /**\r\n * The rotation rotating from inertia major axis space\r\n * to parent space (i.e., the rotation which, when\r\n * applied to the 3x3 inertia tensor causes the inertia\r\n * tensor to become a diagonal matrix). This determines\r\n * how the values of inertia are aligned with the parent\r\n * object.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n inertiaOrientation?: Quaternion;\r\n}\r\n\r\n/**\r\n * Indicates how the body will behave.\r\n */\r\nexport enum PhysicsMotionType {\r\n STATIC,\r\n ANIMATED,\r\n DYNAMIC,\r\n}\r\n\r\n/** @internal */\r\nexport interface IPhysicsEnginePluginV2 {\r\n /**\r\n * Physics plugin world instance\r\n */\r\n world: any;\r\n /**\r\n * Physics plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Collision observable\r\n */\r\n onCollisionObservable: Observable<IPhysicsCollisionEvent>;\r\n\r\n setGravity(gravity: Vector3): void;\r\n setTimeStep(timeStep: number): void;\r\n getTimeStep(): number;\r\n executeStep(delta: number, bodies: Array<PhysicsBody>): void; //not forgetting pre and post events\r\n getPluginVersion(): number;\r\n\r\n // body\r\n initBody(body: PhysicsBody, motionType: PhysicsMotionType, position: Vector3, orientation: Quaternion): void;\r\n initBodyInstances(body: PhysicsBody, motionType: PhysicsMotionType, mesh: Mesh): void;\r\n updateBodyInstances(body: PhysicsBody, mesh: Mesh): void;\r\n removeBody(body: PhysicsBody): void;\r\n sync(body: PhysicsBody): void;\r\n syncTransform(body: PhysicsBody, transformNode: TransformNode): void;\r\n setShape(body: PhysicsBody, shape: Nullable<PhysicsShape>): void;\r\n getShape(body: PhysicsBody): Nullable<PhysicsShape>;\r\n getShapeType(shape: PhysicsShape): PhysicsShapeType;\r\n setEventMask(body: PhysicsBody, eventMask: number, instanceIndex?: number): void;\r\n getEventMask(body: PhysicsBody, instanceIndex?: number): number;\r\n setMotionType(body: PhysicsBody, motionType: PhysicsMotionType, instanceIndex?: number): void;\r\n getMotionType(body: PhysicsBody, instanceIndex?: number): PhysicsMotionType;\r\n computeMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;\r\n setMassProperties(body: PhysicsBody, massProps: PhysicsMassProperties, instanceIndex?: number): void;\r\n getMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;\r\n setLinearDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;\r\n getLinearDamping(body: PhysicsBody, instanceIndex?: number): number;\r\n setAngularDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;\r\n getAngularDamping(body: PhysicsBody, instanceIndex?: number): number;\r\n setLinearVelocity(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;\r\n getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;\r\n applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3, instanceIndex?: number): void;\r\n applyForce(body: PhysicsBody, force: Vector3, location: Vector3, instanceIndex?: number): void;\r\n setAngularVelocity(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;\r\n getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;\r\n getBodyGeometry(body: PhysicsBody): {};\r\n disposeBody(body: PhysicsBody): void;\r\n setCollisionCallbackEnabled(body: PhysicsBody, enabled: boolean, instanceIndex?: number): void;\r\n addConstraint(body: PhysicsBody, childBody: PhysicsBody, constraint: PhysicsConstraint, instanceIndex?: number, childInstanceIndex?: number): void;\r\n getCollisionObservable(body: PhysicsBody, instanceIndex?: number): Observable<IPhysicsCollisionEvent>;\r\n\r\n // shape\r\n initShape(shape: PhysicsShape, type: PhysicsShapeType, options: PhysicsShapeParameters): void;\r\n setShapeFilterMembershipMask(shape: PhysicsShape, membershipMask: number): void;\r\n getShapeFilterMembershipMask(shape: PhysicsShape): number;\r\n setShapeFilterCollideMask(shape: PhysicsShape, collideMask: number): void;\r\n getShapeFilterCollideMask(shape: PhysicsShape): number;\r\n setMaterial(shape: PhysicsShape, material: PhysicsMaterial): void;\r\n setDensity(shape: PhysicsShape, density: number): void;\r\n getDensity(shape: PhysicsShape): number;\r\n addChild(shape: PhysicsShape, newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void;\r\n removeChild(shape: PhysicsShape, childIndex: number): void;\r\n getNumChildren(shape: PhysicsShape): number;\r\n getBoundingBox(shape: PhysicsShape): BoundingBox;\r\n disposeShape(shape: PhysicsShape): void;\r\n\r\n // constraint\r\n initConstraint(constraint: PhysicsConstraint, body: PhysicsBody, childBody: PhysicsBody): void;\r\n setEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getEnabled(constraint: PhysicsConstraint): boolean;\r\n setCollisionsEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getCollisionsEnabled(constraint: PhysicsConstraint): boolean;\r\n setAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, friction: number): void;\r\n getAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;\r\n setAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void;\r\n getAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): PhysicsConstraintAxisLimitMode;\r\n setAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, minLimit: number): void;\r\n getAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;\r\n setAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limit: number): void;\r\n getAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;\r\n setAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void;\r\n getAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): PhysicsConstraintMotorType;\r\n setAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, target: number): void;\r\n getAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;\r\n setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, maxForce: number): void;\r\n getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;\r\n disposeConstraint(constraint: PhysicsConstraint): void;\r\n\r\n // raycast\r\n raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;\r\n\r\n dispose(): void;\r\n}\r\n"]}