@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
@@ -0,0 +1,687 @@
1
+ import { Quaternion, Vector3 } from "../../../Maths/math.vector";
2
+ import { PhysicsShapeType, PhysicsMotionType } from "../IPhysicsEnginePlugin";
3
+ import type { PhysicsShapeParameters, PhysicsConstraintMotorType, IPhysicsEnginePluginV2, PhysicsMassProperties, IPhysicsCollisionEvent } from "../IPhysicsEnginePlugin";
4
+ import type { PhysicsBody } from "../physicsBody";
5
+ import type { PhysicsConstraint } from "../physicsConstraint";
6
+ import type { PhysicsMaterial } from "../physicsMaterial";
7
+ import { PhysicsConstraintAxis } from "../IPhysicsEnginePlugin";
8
+ import { PhysicsConstraintAxisLimitMode } from "../IPhysicsEnginePlugin";
9
+ import { PhysicsShape } from "../physicsShape";
10
+ import type { BoundingBox } from "../../../Culling/boundingBox";
11
+ import type { TransformNode } from "../../../Meshes/transformNode";
12
+ import type { PhysicsRaycastResult } from "../../physicsRaycastResult";
13
+ import { Mesh } from "../../../Meshes/mesh";
14
+ import { Observable } from "../../../Misc/observable";
15
+ import type { Nullable } from "../../../types";
16
+ declare class BodyPluginData {
17
+ constructor(bodyId: any);
18
+ hpBodyId: any;
19
+ worldTransformOffset: number;
20
+ userMassProps: PhysicsMassProperties;
21
+ }
22
+ /**
23
+ * The Havok Physics plugin
24
+ */
25
+ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
26
+ private _useDeltaForWorldStep;
27
+ /**
28
+ * Reference to the WASM library
29
+ */
30
+ _hknp: any;
31
+ /**
32
+ * Created Havok world which physics bodies are added to
33
+ */
34
+ world: any;
35
+ /**
36
+ * Name of the plugin
37
+ */
38
+ name: string;
39
+ /**
40
+ * We only have a single raycast in-flight right now
41
+ */
42
+ private _queryCollector;
43
+ private _fixedTimeStep;
44
+ private _timeStep;
45
+ private _tmpVec3;
46
+ private _bodies;
47
+ private _bodyBuffer;
48
+ private _bodyCollisionObservable;
49
+ /**
50
+ *
51
+ */
52
+ onCollisionObservable: Observable<IPhysicsCollisionEvent>;
53
+ constructor(_useDeltaForWorldStep?: boolean, hpInjection?: any);
54
+ /**
55
+ * If this plugin is supported
56
+ * @returns true if its supported
57
+ */
58
+ isSupported(): boolean;
59
+ /**
60
+ * Sets the gravity of the physics world.
61
+ *
62
+ * @param gravity - The gravity vector to set.
63
+ *
64
+ */
65
+ setGravity(gravity: Vector3): void;
66
+ /**
67
+ * Sets the fixed time step for the physics engine.
68
+ *
69
+ * @param timeStep - The fixed time step to use for the physics engine.
70
+ *
71
+ */
72
+ setTimeStep(timeStep: number): void;
73
+ /**
74
+ * Gets the fixed time step used by the physics engine.
75
+ *
76
+ * @returns The fixed time step used by the physics engine.
77
+ *
78
+ */
79
+ getTimeStep(): number;
80
+ /**
81
+ * Executes a single step of the physics engine.
82
+ *
83
+ * @param delta The time delta in seconds since the last step.
84
+ * @param physicsBodies An array of physics bodies to be simulated.
85
+ * @returns void
86
+ *
87
+ * This method is useful for simulating the physics engine. It sets the physics body transformation,
88
+ * steps the world, syncs the physics body, and notifies collisions. This allows for the physics engine
89
+ * to accurately simulate the physics bodies in the world.
90
+ */
91
+ executeStep(delta: number, physicsBodies: Array<PhysicsBody>): void;
92
+ /**
93
+ * Returns the version of the physics engine plugin.
94
+ *
95
+ * @returns The version of the physics engine plugin.
96
+ *
97
+ * This method is useful for determining the version of the physics engine plugin that is currently running.
98
+ */
99
+ getPluginVersion(): number;
100
+ /**
101
+ * Initializes a physics body with the given position and orientation.
102
+ *
103
+ * @param body - The physics body to initialize.
104
+ * @param position - The position of the body.
105
+ * @param orientation - The orientation of the body.
106
+ * This code is useful for initializing a physics body with the given position and orientation.
107
+ * It creates a plugin data for the body and adds it to the world. It then converts the position
108
+ * and orientation to a transform and sets the body's transform to the given values.
109
+ */
110
+ initBody(body: PhysicsBody, motionType: PhysicsMotionType, position: Vector3, orientation: Quaternion): void;
111
+ /**
112
+ * Removes a body from the world. To dispose of a body, it is necessary to remove it from the world first.
113
+ *
114
+ * @param body - The body to remove.
115
+ */
116
+ removeBody(body: PhysicsBody): void;
117
+ /**
118
+ * Initializes the body instances for a given physics body and mesh.
119
+ *
120
+ * @param body - The physics body to initialize.
121
+ * @param motionType - How the body will be handled by the engine
122
+ * @param mesh - The mesh to initialize.
123
+ *
124
+ * This code is useful for creating a physics body from a mesh. It creates a
125
+ * body instance for each instance of the mesh and adds it to the world. It also
126
+ * sets the position of the body instance to the position of the mesh instance.
127
+ * This allows for the physics engine to accurately simulate the mesh in the
128
+ * world.
129
+ */
130
+ initBodyInstances(body: PhysicsBody, motionType: PhysicsMotionType, mesh: Mesh): void;
131
+ private _createOrUpdateBodyInstances;
132
+ /**
133
+ * Update the internal body instances for a given physics body to match the instances in a mesh.
134
+ * @param body the body that will be updated
135
+ * @param mesh the mesh with reference instances
136
+ */
137
+ updateBodyInstances(body: PhysicsBody, mesh: Mesh): void;
138
+ /**
139
+ * Synchronizes the transform of a physics body with its transform node.
140
+ * @param body - The physics body to synchronize.
141
+ *
142
+ * This function is useful for keeping the physics body's transform in sync with its transform node.
143
+ * This is important for ensuring that the physics body is accurately represented in the physics engine.
144
+ */
145
+ sync(body: PhysicsBody): void;
146
+ /**
147
+ * Synchronizes the transform of a physics body with the transform of its
148
+ * corresponding transform node.
149
+ *
150
+ * @param body - The physics body to synchronize.
151
+ * @param transformNode - The destination Transform Node.
152
+ *
153
+ * This code is useful for synchronizing the position and orientation of a
154
+ * physics body with the position and orientation of its corresponding
155
+ * transform node. This is important for ensuring that the physics body and
156
+ * the transform node are in the same position and orientation in the scene.
157
+ * This is necessary for the physics engine to accurately simulate the
158
+ * physical behavior of the body.
159
+ */
160
+ syncTransform(body: PhysicsBody, transformNode: TransformNode): void;
161
+ /**
162
+ * Sets the shape of a physics body.
163
+ * @param body - The physics body to set the shape for.
164
+ * @param shape - The physics shape to set.
165
+ *
166
+ * This function is used to set the shape of a physics body. It is useful for
167
+ * creating a physics body with a specific shape, such as a box or a sphere,
168
+ * which can then be used to simulate physical interactions in a physics engine.
169
+ * This function is especially useful for meshes with multiple instances, as it
170
+ * will set the shape for each instance of the mesh.
171
+ */
172
+ setShape(body: PhysicsBody, shape: Nullable<PhysicsShape>): void;
173
+ /**
174
+ * Returns a reference to the first instance of the plugin data for a physics body.
175
+ * @param body
176
+ * @param instanceIndex
177
+ * @returns a reference to the first instance
178
+ */
179
+ private _getPluginReference;
180
+ /**
181
+ * Gets the shape of a physics body. This will create a new shape object
182
+ *
183
+ * @param body - The physics body.
184
+ * @returns The shape of the physics body.
185
+ *
186
+ */
187
+ getShape(body: PhysicsBody): Nullable<PhysicsShape>;
188
+ /**
189
+ * Gets the type of a physics shape.
190
+ * @param shape - The physics shape to get the type for.
191
+ * @returns The type of the physics shape.
192
+ *
193
+ */
194
+ getShapeType(shape: PhysicsShape): PhysicsShapeType;
195
+ /**
196
+ * Sets the event mask of a physics body.
197
+ * @param body - The physics body to set the event mask for.
198
+ * @param eventMask - The event mask to set.
199
+ *
200
+ * This function is useful for setting the event mask of a physics body, which is used to determine which events the body will respond to. This is important for ensuring that the physics engine is able to accurately simulate the behavior of the body in the game world.
201
+ */
202
+ setEventMask(body: PhysicsBody, eventMask: number, instanceIndex?: number): void;
203
+ /**
204
+ * Retrieves the event mask of a physics body.
205
+ *
206
+ * @param body - The physics body to retrieve the event mask from.
207
+ * @returns The event mask of the physics body.
208
+ *
209
+ */
210
+ getEventMask(body: PhysicsBody, instanceIndex?: number): number;
211
+ private _fromMassPropertiesTuple;
212
+ private _internalUpdateMassProperties;
213
+ _internalSetMotionType(pluginData: BodyPluginData, motionType: PhysicsMotionType): void;
214
+ setMotionType(body: PhysicsBody, motionType: PhysicsMotionType, instanceIndex?: number): void;
215
+ getMotionType(body: PhysicsBody, instanceIndex?: number): PhysicsMotionType;
216
+ private _internalComputeMassProperties;
217
+ /**
218
+ * Computes the mass properties of a physics body, from it's shape
219
+ *
220
+ * @param body - The physics body to copmute the mass properties of
221
+ */
222
+ computeMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;
223
+ /**
224
+ * Sets the mass properties of a physics body.
225
+ *
226
+ * @param body - The physics body to set the mass properties of.
227
+ * @param massProps - The mass properties to set.
228
+ * @param instanceIndex - The index of the instance to set the mass properties of. If undefined, the mass properties of all the bodies will be set.
229
+ * This function is useful for setting the mass properties of a physics body,
230
+ * such as its mass, inertia, and center of mass. This is important for
231
+ * accurately simulating the physics of the body in the physics engine.
232
+ *
233
+ */
234
+ setMassProperties(body: PhysicsBody, massProps: PhysicsMassProperties, instanceIndex?: number): void;
235
+ /**
236
+ *
237
+ */
238
+ getMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;
239
+ /**
240
+ * Sets the linear damping of the given body.
241
+ * @param body - The body to set the linear damping for.
242
+ * @param damping - The linear damping to set.
243
+ *
244
+ * This method is useful for controlling the linear damping of a body in a physics engine.
245
+ * Linear damping is a force that opposes the motion of the body, and is proportional to the velocity of the body.
246
+ * This method allows the user to set the linear damping of a body, which can be used to control the motion of the body.
247
+ */
248
+ setLinearDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;
249
+ /**
250
+ * Gets the linear damping of the given body.
251
+ * @param body - The body to get the linear damping from.
252
+ * @returns The linear damping of the given body.
253
+ *
254
+ * This method is useful for getting the linear damping of a body in a physics engine.
255
+ * Linear damping is a force that opposes the motion of the body and is proportional to the velocity of the body.
256
+ * It is used to simulate the effects of air resistance and other forms of friction.
257
+ */
258
+ getLinearDamping(body: PhysicsBody, instanceIndex?: number): number;
259
+ /**
260
+ * Sets the angular damping of a physics body.
261
+ * @param body - The physics body to set the angular damping for.
262
+ * @param damping - The angular damping value to set.
263
+ *
264
+ * This function is useful for controlling the angular velocity of a physics body.
265
+ * By setting the angular damping, the body's angular velocity will be reduced over time, allowing for more realistic physics simulations.
266
+ */
267
+ setAngularDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;
268
+ /**
269
+ * Gets the angular damping of a physics body.
270
+ * @param body - The physics body to get the angular damping from.
271
+ * @returns The angular damping of the body.
272
+ *
273
+ * This function is useful for retrieving the angular damping of a physics body,
274
+ * which is used to control the rotational motion of the body. The angular damping is a value between 0 and 1, where 0 is no damping and 1 is full damping.
275
+ */
276
+ getAngularDamping(body: PhysicsBody, instanceIndex?: number): number;
277
+ /**
278
+ * Sets the linear velocity of a physics body.
279
+ * @param body - The physics body to set the linear velocity of.
280
+ * @param linVel - The linear velocity to set.
281
+ *
282
+ * This function is useful for setting the linear velocity of a physics body, which is necessary for simulating
283
+ * motion in a physics engine. The linear velocity is the speed and direction of the body's movement.
284
+ */
285
+ setLinearVelocity(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;
286
+ /**
287
+ * Gets the linear velocity of a physics body and stores it in a given vector.
288
+ * @param body - The physics body to get the linear velocity from.
289
+ * @param linVel - The vector to store the linear velocity in.
290
+ *
291
+ * This function is useful for retrieving the linear velocity of a physics body,
292
+ * which can be used to determine the speed and direction of the body. This
293
+ * information can be used to simulate realistic physics behavior in a game.
294
+ */
295
+ getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;
296
+ private _applyToBodyOrInstances;
297
+ /**
298
+ * Applies an impulse to a physics body at a given location.
299
+ * @param body - The physics body to apply the impulse to.
300
+ * @param impulse - The impulse vector to apply.
301
+ * @param location - The location in world space to apply the impulse.
302
+ * @param instanceIndex - The index of the instance to apply the impulse to. If not specified, the impulse will be applied to all instances.
303
+ *
304
+ * This method is useful for applying an impulse to a physics body at a given location.
305
+ * This can be used to simulate physical forces such as explosions, collisions, and gravity.
306
+ */
307
+ applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3, instanceIndex?: number): void;
308
+ /**
309
+ * Applies a force to a physics body at a given location.
310
+ * @param body - The physics body to apply the impulse to.
311
+ * @param force - The force vector to apply.
312
+ * @param location - The location in world space to apply the impulse.
313
+ * @param instanceIndex - The index of the instance to apply the force to. If not specified, the force will be applied to all instances.
314
+ *
315
+ * This method is useful for applying a force to a physics body at a given location.
316
+ * This can be used to simulate physical forces such as explosions, collisions, and gravity.
317
+ */
318
+ applyForce(body: PhysicsBody, force: Vector3, location: Vector3, instanceIndex?: number): void;
319
+ /**
320
+ * Sets the angular velocity of a physics body.
321
+ *
322
+ * @param body - The physics body to set the angular velocity of.
323
+ * @param angVel - The angular velocity to set.
324
+ *
325
+ * This function is useful for setting the angular velocity of a physics body in a physics engine.
326
+ * This allows for more realistic simulations of physical objects, as they can be given a rotational velocity.
327
+ */
328
+ setAngularVelocity(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;
329
+ /**
330
+ * Gets the angular velocity of a body.
331
+ * @param body - The body to get the angular velocity from.
332
+ * @param angVel - The vector3 to store the angular velocity.
333
+ *
334
+ * This method is useful for getting the angular velocity of a body in a physics engine. It
335
+ * takes the body and a vector3 as parameters and stores the angular velocity of the body
336
+ * in the vector3. This is useful for getting the angular velocity of a body in order to
337
+ * calculate the motion of the body in the physics engine.
338
+ */
339
+ getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;
340
+ /**
341
+ * Sets the transformation of the given physics body to the given transform node.
342
+ * @param body The physics body to set the transformation for.
343
+ * @param node The transform node to set the transformation from.
344
+ * Sets the transformation of the given physics body to the given transform node.
345
+ *
346
+ * This function is useful for setting the transformation of a physics body to a
347
+ * transform node, which is necessary for the physics engine to accurately simulate
348
+ * the motion of the body. It also takes into account instances of the transform
349
+ * node, which is necessary for accurate simulation of multiple bodies with the
350
+ * same transformation.
351
+ */
352
+ setPhysicsBodyTransformation(body: PhysicsBody, node: TransformNode): void;
353
+ /**
354
+ * Disposes a physics body.
355
+ *
356
+ * @param body - The physics body to dispose.
357
+ *
358
+ * This method is useful for releasing the resources associated with a physics body when it is no longer needed.
359
+ * This is important for avoiding memory leaks in the physics engine.
360
+ */
361
+ disposeBody(body: PhysicsBody): void;
362
+ /**
363
+ * Initializes a physics shape with the given type and parameters.
364
+ * @param shape - The physics shape to initialize.
365
+ * @param type - The type of shape to initialize.
366
+ * @param options - The parameters for the shape.
367
+ *
368
+ * This code is useful for initializing a physics shape with the given type and parameters.
369
+ * It allows for the creation of a sphere, box, capsule, container, cylinder, mesh, and heightfield.
370
+ * Depending on the type of shape, different parameters are required.
371
+ * For example, a sphere requires a radius, while a box requires extents and a rotation.
372
+ */
373
+ initShape(shape: PhysicsShape, type: PhysicsShapeType, options: PhysicsShapeParameters): void;
374
+ setShapeFilterMembershipMask(shape: PhysicsShape, membershipMask: number): void;
375
+ getShapeFilterMembershipMask(shape: PhysicsShape): number;
376
+ setShapeFilterCollideMask(shape: PhysicsShape, collideMask: number): void;
377
+ getShapeFilterCollideMask(shape: PhysicsShape): number;
378
+ /**
379
+ * Sets the material of a physics shape.
380
+ * @param shape - The physics shape to set the material of.
381
+ * @param material - The material to set.
382
+ *
383
+ */
384
+ setMaterial(shape: PhysicsShape, material: PhysicsMaterial): void;
385
+ /**
386
+ * Sets the density of a physics shape.
387
+ * @param shape - The physics shape to set the density of.
388
+ * @param density - The density to set.
389
+ *
390
+ */
391
+ setDensity(shape: PhysicsShape, density: number): void;
392
+ /**
393
+ * Calculates the density of a given physics shape.
394
+ *
395
+ * @param shape - The physics shape to calculate the density of.
396
+ * @returns The density of the given physics shape.
397
+ *
398
+ */
399
+ getDensity(shape: PhysicsShape): number;
400
+ /**
401
+ * Gets the transform infos of a given transform node.
402
+ * @param node - The transform node.
403
+ * @returns An array containing the position and orientation of the node.
404
+ * This code is useful for getting the position and orientation of a given transform node.
405
+ * It first checks if the node has a rotation quaternion, and if not, it creates one from the node's rotation.
406
+ * It then creates an array containing the position and orientation of the node and returns it.
407
+ */
408
+ private _getTransformInfos;
409
+ /**
410
+ * Adds a child shape to the given shape.
411
+ * @param shape - The parent shape.
412
+ * @param newChild - The child shape to add.
413
+ * @param childTransform - The transform of the child shape relative to the parent shape.
414
+ *
415
+ */
416
+ addChild(shape: PhysicsShape, newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void;
417
+ /**
418
+ * Removes a child shape from a parent shape.
419
+ * @param shape - The parent shape.
420
+ * @param childIndex - The index of the child shape to remove.
421
+ *
422
+ */
423
+ removeChild(shape: PhysicsShape, childIndex: number): void;
424
+ /**
425
+ * Returns the number of children of the given shape.
426
+ *
427
+ * @param shape - The shape to get the number of children from.
428
+ * @returns The number of children of the given shape.
429
+ *
430
+ */
431
+ getNumChildren(shape: PhysicsShape): number;
432
+ /**
433
+ * Calculates the bounding box of a given physics shape.
434
+ *
435
+ * @param shape - The physics shape to calculate the bounding box for.
436
+ * @returns The calculated bounding box.
437
+ *
438
+ * This method is useful for physics engines as it allows to calculate the
439
+ * boundaries of a given shape. Knowing the boundaries of a shape is important
440
+ * for collision detection and other physics calculations.
441
+ */
442
+ getBoundingBox(shape: PhysicsShape): BoundingBox;
443
+ /**
444
+ * Gets the geometry of a physics body.
445
+ *
446
+ * @param body - The physics body.
447
+ * @returns An object containing the positions and indices of the body's geometry.
448
+ *
449
+ */
450
+ getBodyGeometry(body: PhysicsBody): {
451
+ positions: never[];
452
+ indices: never[];
453
+ } | {
454
+ positions: Float32Array;
455
+ indices: Uint32Array;
456
+ };
457
+ /**
458
+ * Releases a physics shape from the physics engine.
459
+ *
460
+ * @param shape - The physics shape to be released.
461
+ * @returns void
462
+ *
463
+ * This method is useful for releasing a physics shape from the physics engine, freeing up resources and preventing memory leaks.
464
+ */
465
+ disposeShape(shape: PhysicsShape): void;
466
+ /**
467
+ * Initializes a physics constraint with the given parameters.
468
+ *
469
+ * @param constraint - The physics constraint to be initialized.
470
+ * @param body - The main body
471
+ * @param childBody - The child body.
472
+ * @param instanceIndex - If this body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.
473
+ * @param childInstanceIndex - If the child body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.
474
+ *
475
+ * This function is useful for setting up a physics constraint in a physics engine.
476
+ */
477
+ initConstraint(constraint: PhysicsConstraint, body: PhysicsBody, childBody: PhysicsBody, instanceIndex?: number, childInstanceIndex?: number): void;
478
+ /**
479
+ * Adds a constraint to the physics engine.
480
+ *
481
+ * @param body - The main body to which the constraint is applied.
482
+ * @param childBody - The body to which the constraint is applied.
483
+ * @param constraint - The constraint to be applied.
484
+ * * @param instanceIndex - If this body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.
485
+ * @param childInstanceIndex - If the child body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.
486
+ */
487
+ addConstraint(body: PhysicsBody, childBody: PhysicsBody, constraint: PhysicsConstraint, instanceIndex?: number, childInstanceIndex?: number): void;
488
+ /**
489
+ * Enables or disables a constraint in the physics engine.
490
+ * @param constraint - The constraint to enable or disable.
491
+ * @param isEnabled - Whether the constraint should be enabled or disabled.
492
+ *
493
+ */
494
+ setEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;
495
+ /**
496
+ * Gets the enabled state of the given constraint.
497
+ * @param constraint - The constraint to get the enabled state from.
498
+ * @returns The enabled state of the given constraint.
499
+ *
500
+ */
501
+ getEnabled(constraint: PhysicsConstraint): boolean;
502
+ /**
503
+ * Enables or disables collisions for the given constraint.
504
+ * @param constraint - The constraint to enable or disable collisions for.
505
+ * @param isEnabled - Whether collisions should be enabled or disabled.
506
+ *
507
+ */
508
+ setCollisionsEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;
509
+ /**
510
+ * Gets whether collisions are enabled for the given constraint.
511
+ * @param constraint - The constraint to get collisions enabled for.
512
+ * @returns Whether collisions are enabled for the given constraint.
513
+ *
514
+ */
515
+ getCollisionsEnabled(constraint: PhysicsConstraint): boolean;
516
+ /**
517
+ * Sets the friction of the given axis of the given constraint.
518
+ *
519
+ * @param constraint - The constraint to set the friction of.
520
+ * @param axis - The axis of the constraint to set the friction of.
521
+ * @param friction - The friction to set.
522
+ * @returns void
523
+ *
524
+ */
525
+ setAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, friction: number): void;
526
+ /**
527
+ * Gets the friction value of the specified axis of the given constraint.
528
+ *
529
+ * @param constraint - The constraint to get the axis friction from.
530
+ * @param axis - The axis to get the friction from.
531
+ * @returns The friction value of the specified axis.
532
+ *
533
+ */
534
+ getAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
535
+ /**
536
+ * Sets the limit mode of the specified axis of the given constraint.
537
+ * @param constraint - The constraint to set the axis mode of.
538
+ * @param axis - The axis to set the limit mode of.
539
+ * @param limitMode - The limit mode to set.
540
+ */
541
+ setAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void;
542
+ /**
543
+ * Gets the axis limit mode of the given constraint.
544
+ *
545
+ * @param constraint - The constraint to get the axis limit mode from.
546
+ * @param axis - The axis to get the limit mode from.
547
+ * @returns The axis limit mode of the given constraint.
548
+ *
549
+ */
550
+ getAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): PhysicsConstraintAxisLimitMode;
551
+ /**
552
+ * Sets the minimum limit of the given axis of the given constraint.
553
+ * @param constraint - The constraint to set the minimum limit of.
554
+ * @param axis - The axis to set the minimum limit of.
555
+ * @param limit - The minimum limit to set.
556
+ *
557
+ */
558
+ setAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limit: number): void;
559
+ /**
560
+ * Gets the minimum limit of the specified axis of the given constraint.
561
+ * @param constraint - The constraint to get the minimum limit from.
562
+ * @param axis - The axis to get the minimum limit from.
563
+ * @returns The minimum limit of the specified axis of the given constraint.
564
+ *
565
+ */
566
+ getAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
567
+ /**
568
+ * Sets the maximum limit of the given axis of the given constraint.
569
+ * @param constraint - The constraint to set the maximum limit of the given axis.
570
+ * @param axis - The axis to set the maximum limit of.
571
+ * @param limit - The maximum limit to set.
572
+ *
573
+ */
574
+ setAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limit: number): void;
575
+ /**
576
+ * Gets the maximum limit of the given axis of the given constraint.
577
+ *
578
+ * @param constraint - The constraint to get the maximum limit from.
579
+ * @param axis - The axis to get the maximum limit from.
580
+ * @returns The maximum limit of the given axis of the given constraint.
581
+ *
582
+ */
583
+ getAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
584
+ /**
585
+ * Sets the motor type of the given axis of the given constraint.
586
+ * @param constraint - The constraint to set the motor type of.
587
+ * @param axis - The axis of the constraint to set the motor type of.
588
+ * @param motorType - The motor type to set.
589
+ * @returns void
590
+ *
591
+ */
592
+ setAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void;
593
+ /**
594
+ * Gets the motor type of the specified axis of the given constraint.
595
+ * @param constraint - The constraint to get the motor type from.
596
+ * @param axis - The axis of the constraint to get the motor type from.
597
+ * @returns The motor type of the specified axis of the given constraint.
598
+ *
599
+ */
600
+ getAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): PhysicsConstraintMotorType;
601
+ /**
602
+ * Sets the target of an axis motor of a constraint.
603
+ *
604
+ * @param constraint - The constraint to set the axis motor target of.
605
+ * @param axis - The axis of the constraint to set the motor target of.
606
+ * @param target - The target of the axis motor.
607
+ *
608
+ */
609
+ setAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, target: number): void;
610
+ /**
611
+ * Gets the target of the motor of the given axis of the given constraint.
612
+ *
613
+ * @param constraint - The constraint to get the motor target from.
614
+ * @param axis - The axis of the constraint to get the motor target from.
615
+ * @returns The target of the motor of the given axis of the given constraint.
616
+ *
617
+ */
618
+ getAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
619
+ /**
620
+ * Sets the maximum force that can be applied by the motor of the given constraint axis.
621
+ * @param constraint - The constraint to set the motor max force for.
622
+ * @param axis - The axis of the constraint to set the motor max force for.
623
+ * @param maxForce - The maximum force that can be applied by the motor.
624
+ *
625
+ */
626
+ setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, maxForce: number): void;
627
+ /**
628
+ * Gets the maximum force of the motor of the given constraint axis.
629
+ *
630
+ * @param constraint - The constraint to get the motor maximum force from.
631
+ * @param axis - The axis of the constraint to get the motor maximum force from.
632
+ * @returns The maximum force of the motor of the given constraint axis.
633
+ *
634
+ */
635
+ getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number;
636
+ /**
637
+ * Disposes a physics constraint.
638
+ *
639
+ * @param constraint - The physics constraint to dispose.
640
+ *
641
+ * This method is useful for releasing the resources associated with a physics constraint, such as
642
+ * the Havok constraint, when it is no longer needed. This is important for avoiding memory leaks.
643
+ */
644
+ disposeConstraint(constraint: PhysicsConstraint): void;
645
+ /**
646
+ * Performs a raycast from a given start point to a given end point and stores the result in a given PhysicsRaycastResult object.
647
+ *
648
+ * @param from - The start point of the raycast.
649
+ * @param to - The end point of the raycast.
650
+ * @param result - The PhysicsRaycastResult object to store the result of the raycast.
651
+ *
652
+ * Performs a raycast. It takes in two points, from and to, and a PhysicsRaycastResult object to store the result of the raycast.
653
+ * It then performs the raycast and stores the hit data in the PhysicsRaycastResult object.
654
+ */
655
+ raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;
656
+ /**
657
+ * Return the collision observable for a particular physics body.
658
+ * @param body the physics body
659
+ */
660
+ getCollisionObservable(body: PhysicsBody): Observable<IPhysicsCollisionEvent>;
661
+ /**
662
+ * Enable collision to be reported for a body when a callback is settup on the world
663
+ * @param body the physics body
664
+ * @param enabled
665
+ */
666
+ setCollisionCallbackEnabled(body: PhysicsBody, enabled: boolean): void;
667
+ /**
668
+ * Runs thru all detected collisions and filter by body
669
+ */
670
+ private _notifyCollisions;
671
+ /**
672
+ * Gets the number of bodies in the world
673
+ */
674
+ get numBodies(): any;
675
+ /**
676
+ * Dispose the world and free resources
677
+ */
678
+ dispose(): void;
679
+ private _v3ToBvecRef;
680
+ private _bVecToV3;
681
+ private _bQuatToV4;
682
+ private _materialCombineToNative;
683
+ private _constraintAxisToNative;
684
+ private _nativeToLimitMode;
685
+ private _limitModeToNative;
686
+ }
687
+ export {};