@babylonjs/core 5.35.0 → 5.36.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 (250) hide show
  1. package/Audio/sound.d.ts +5 -0
  2. package/Audio/sound.js +7 -0
  3. package/Audio/sound.js.map +1 -1
  4. package/Debug/physicsViewer.d.ts +4 -3
  5. package/Debug/physicsViewer.js +2 -2
  6. package/Debug/physicsViewer.js.map +1 -1
  7. package/Engines/Extensions/engine.renderTarget.js +15 -15
  8. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  9. package/Engines/Extensions/engine.renderTargetCube.d.ts +1 -1
  10. package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
  11. package/Engines/Extensions/engine.views.d.ts +4 -0
  12. package/Engines/Extensions/engine.views.js +61 -42
  13. package/Engines/Extensions/engine.views.js.map +1 -1
  14. package/Engines/Native/nativeHardwareTexture.d.ts +14 -0
  15. package/Engines/Native/nativeHardwareTexture.js +24 -0
  16. package/Engines/Native/nativeHardwareTexture.js.map +1 -0
  17. package/Engines/Native/nativeInterfaces.d.ts +22 -15
  18. package/Engines/Native/nativeInterfaces.js.map +1 -1
  19. package/Engines/Native/nativePipelineContext.d.ts +252 -0
  20. package/Engines/Native/nativePipelineContext.js +502 -0
  21. package/Engines/Native/nativePipelineContext.js.map +1 -0
  22. package/Engines/Native/nativeRenderTargetWrapper.d.ts +16 -0
  23. package/Engines/Native/nativeRenderTargetWrapper.js +33 -0
  24. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -0
  25. package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
  26. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  27. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  28. package/Engines/engine.d.ts +1 -0
  29. package/Engines/engine.js +24 -18
  30. package/Engines/engine.js.map +1 -1
  31. package/Engines/nativeEngine.d.ts +18 -17
  32. package/Engines/nativeEngine.js +100 -598
  33. package/Engines/nativeEngine.js.map +1 -1
  34. package/Engines/nullEngine.d.ts +1 -1
  35. package/Engines/nullEngine.js.map +1 -1
  36. package/Engines/thinEngine.d.ts +1 -1
  37. package/Engines/thinEngine.js +41 -38
  38. package/Engines/thinEngine.js.map +1 -1
  39. package/Engines/webgpuEngine.js.map +1 -1
  40. package/Gizmos/planeRotationGizmo.js +3 -1
  41. package/Gizmos/planeRotationGizmo.js.map +1 -1
  42. package/Inputs/scene.inputManager.js +4 -4
  43. package/Inputs/scene.inputManager.js.map +1 -1
  44. package/Loading/Plugins/babylonFileLoader.js +3 -3
  45. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  46. package/Materials/Node/Blocks/Dual/textureBlock.js +1 -1
  47. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  48. package/Materials/Node/nodeMaterial.d.ts +19 -1
  49. package/Materials/Node/nodeMaterial.js +30 -0
  50. package/Materials/Node/nodeMaterial.js.map +1 -1
  51. package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +2 -8
  52. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  53. package/Materials/Textures/baseTexture.d.ts +2 -1
  54. package/Materials/Textures/baseTexture.js +3 -2
  55. package/Materials/Textures/baseTexture.js.map +1 -1
  56. package/Materials/Textures/internalTexture.d.ts +2 -0
  57. package/Materials/Textures/internalTexture.js +4 -0
  58. package/Materials/Textures/internalTexture.js.map +1 -1
  59. package/Materials/Textures/mirrorTexture.js +0 -2
  60. package/Materials/Textures/mirrorTexture.js.map +1 -1
  61. package/Materials/Textures/renderTargetTexture.d.ts +53 -3
  62. package/Materials/Textures/renderTargetTexture.js +25 -25
  63. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  64. package/Materials/Textures/texture.d.ts +2 -0
  65. package/Materials/Textures/texture.js +35 -7
  66. package/Materials/Textures/texture.js.map +1 -1
  67. package/Materials/Textures/textureCreationOptions.d.ts +4 -1
  68. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  69. package/Materials/material.js +1 -1
  70. package/Materials/material.js.map +1 -1
  71. package/Meshes/abstractMesh.d.ts +4 -4
  72. package/Meshes/abstractMesh.js +4 -4
  73. package/Meshes/abstractMesh.js.map +1 -1
  74. package/Meshes/mesh.d.ts +2 -2
  75. package/Meshes/mesh.js +1 -1
  76. package/Meshes/mesh.js.map +1 -1
  77. package/Misc/copyTextureToTexture.d.ts +9 -2
  78. package/Misc/copyTextureToTexture.js +23 -1
  79. package/Misc/copyTextureToTexture.js.map +1 -1
  80. package/Particles/IParticleSystem.d.ts +15 -1
  81. package/Particles/IParticleSystem.js.map +1 -1
  82. package/Particles/gpuParticleSystem.d.ts +24 -2
  83. package/Particles/gpuParticleSystem.js +98 -43
  84. package/Particles/gpuParticleSystem.js.map +1 -1
  85. package/Particles/particleSystem.d.ts +6 -1
  86. package/Particles/particleSystem.js +7 -2
  87. package/Particles/particleSystem.js.map +1 -1
  88. package/Physics/IPhysicsEngine.d.ts +8 -108
  89. package/Physics/IPhysicsEngine.js.map +1 -1
  90. package/Physics/Plugins/ammoJSPlugin.d.ts +1 -389
  91. package/Physics/Plugins/ammoJSPlugin.js +2 -1414
  92. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  93. package/Physics/Plugins/cannonJSPlugin.d.ts +1 -75
  94. package/Physics/Plugins/cannonJSPlugin.js +2 -664
  95. package/Physics/Plugins/cannonJSPlugin.js.map +1 -1
  96. package/Physics/Plugins/oimoJSPlugin.d.ts +1 -59
  97. package/Physics/Plugins/oimoJSPlugin.js +2 -432
  98. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  99. package/Physics/index.d.ts +3 -6
  100. package/Physics/index.js +3 -6
  101. package/Physics/index.js.map +1 -1
  102. package/Physics/physicsEngine.d.ts +1 -135
  103. package/Physics/physicsEngine.js +2 -221
  104. package/Physics/physicsEngine.js.map +1 -1
  105. package/Physics/physicsEngineComponent.d.ts +7 -42
  106. package/Physics/physicsEngineComponent.js +11 -71
  107. package/Physics/physicsEngineComponent.js.map +1 -1
  108. package/Physics/physicsHelper.d.ts +1 -411
  109. package/Physics/physicsHelper.js +2 -708
  110. package/Physics/physicsHelper.js.map +1 -1
  111. package/Physics/physicsImpostor.d.ts +1 -640
  112. package/Physics/physicsImpostor.js +2 -1004
  113. package/Physics/physicsImpostor.js.map +1 -1
  114. package/Physics/physicsJoint.d.ts +1 -275
  115. package/Physics/physicsJoint.js +2 -222
  116. package/Physics/physicsJoint.js.map +1 -1
  117. package/Physics/v1/IPhysicsEnginePlugin.d.ts +73 -0
  118. package/Physics/v1/IPhysicsEnginePlugin.js +2 -0
  119. package/Physics/v1/IPhysicsEnginePlugin.js.map +1 -0
  120. package/Physics/v1/Plugins/ammoJSPlugin.d.ts +401 -0
  121. package/Physics/v1/Plugins/ammoJSPlugin.js +1431 -0
  122. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -0
  123. package/Physics/v1/Plugins/cannonJSPlugin.d.ts +87 -0
  124. package/Physics/v1/Plugins/cannonJSPlugin.js +683 -0
  125. package/Physics/v1/Plugins/cannonJSPlugin.js.map +1 -0
  126. package/Physics/{Plugins → v1/Plugins}/index.d.ts +0 -0
  127. package/Physics/{Plugins → v1/Plugins}/index.js +0 -0
  128. package/Physics/v1/Plugins/index.js.map +1 -0
  129. package/Physics/v1/Plugins/oimoJSPlugin.d.ts +71 -0
  130. package/Physics/v1/Plugins/oimoJSPlugin.js +450 -0
  131. package/Physics/v1/Plugins/oimoJSPlugin.js.map +1 -0
  132. package/Physics/v1/index.d.ts +7 -0
  133. package/Physics/v1/index.js +9 -0
  134. package/Physics/v1/index.js.map +1 -0
  135. package/Physics/v1/physicsEngine.d.ts +147 -0
  136. package/Physics/v1/physicsEngine.js +237 -0
  137. package/Physics/v1/physicsEngine.js.map +1 -0
  138. package/Physics/v1/physicsEngineComponent.d.ts +45 -0
  139. package/Physics/v1/physicsEngineComponent.js +70 -0
  140. package/Physics/v1/physicsEngineComponent.js.map +1 -0
  141. package/Physics/v1/physicsHelper.d.ts +411 -0
  142. package/Physics/v1/physicsHelper.js +709 -0
  143. package/Physics/v1/physicsHelper.js.map +1 -0
  144. package/Physics/v1/physicsImpostor.d.ts +636 -0
  145. package/Physics/v1/physicsImpostor.js +1001 -0
  146. package/Physics/v1/physicsImpostor.js.map +1 -0
  147. package/Physics/v1/physicsJoint.d.ts +275 -0
  148. package/Physics/v1/physicsJoint.js +223 -0
  149. package/Physics/v1/physicsJoint.js.map +1 -0
  150. package/Physics/v2/IPhysicsEnginePlugin.d.ts +170 -0
  151. package/Physics/v2/IPhysicsEnginePlugin.js +47 -0
  152. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -0
  153. package/Physics/v2/Plugins/index.d.ts +0 -0
  154. package/Physics/v2/Plugins/index.js +2 -0
  155. package/Physics/v2/Plugins/index.js.map +1 -0
  156. package/Physics/v2/index.d.ts +6 -0
  157. package/Physics/v2/index.js +8 -0
  158. package/Physics/v2/index.js.map +1 -0
  159. package/Physics/v2/physicsAggregate.d.ts +114 -0
  160. package/Physics/v2/physicsAggregate.js +46 -0
  161. package/Physics/v2/physicsAggregate.js.map +1 -0
  162. package/Physics/v2/physicsBody.d.ts +109 -0
  163. package/Physics/v2/physicsBody.js +158 -0
  164. package/Physics/v2/physicsBody.js.map +1 -0
  165. package/Physics/v2/physicsConstraint.d.ts +184 -0
  166. package/Physics/v2/physicsConstraint.js +257 -0
  167. package/Physics/v2/physicsConstraint.js.map +1 -0
  168. package/Physics/v2/physicsEngine.d.ts +103 -0
  169. package/Physics/v2/physicsEngine.js +146 -0
  170. package/Physics/v2/physicsEngine.js.map +1 -0
  171. package/Physics/v2/physicsEngineComponent.d.ts +31 -0
  172. package/Physics/v2/physicsEngineComponent.js +50 -0
  173. package/Physics/v2/physicsEngineComponent.js.map +1 -0
  174. package/Physics/v2/physicsMaterial.d.ts +45 -0
  175. package/Physics/v2/physicsMaterial.js +67 -0
  176. package/Physics/v2/physicsMaterial.js.map +1 -0
  177. package/Physics/v2/physicsShape.d.ts +182 -0
  178. package/Physics/v2/physicsShape.js +229 -0
  179. package/Physics/v2/physicsShape.js.map +1 -0
  180. package/PostProcesses/postProcess.d.ts +3 -1
  181. package/PostProcesses/postProcess.js +4 -1
  182. package/PostProcesses/postProcess.js.map +1 -1
  183. package/Rendering/fluidRenderer/fluidRenderer.d.ts +153 -0
  184. package/Rendering/fluidRenderer/fluidRenderer.js +410 -0
  185. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -0
  186. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.d.ts +13 -0
  187. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +31 -0
  188. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -0
  189. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +81 -0
  190. package/Rendering/fluidRenderer/fluidRenderingObject.js +180 -0
  191. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -0
  192. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +63 -0
  193. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +130 -0
  194. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -0
  195. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +64 -0
  196. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +104 -0
  197. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -0
  198. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +234 -0
  199. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +690 -0
  200. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -0
  201. package/Rendering/fluidRenderer/fluidRenderingTextures.d.ts +56 -0
  202. package/Rendering/fluidRenderer/fluidRenderingTextures.js +261 -0
  203. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -0
  204. package/Rendering/fluidRenderer/index.d.ts +5 -0
  205. package/Rendering/fluidRenderer/index.js +6 -0
  206. package/Rendering/fluidRenderer/index.js.map +1 -0
  207. package/Rendering/index.d.ts +1 -0
  208. package/Rendering/index.js +2 -0
  209. package/Rendering/index.js.map +1 -1
  210. package/Shaders/copyTextureToTexture.fragment.js +4 -1
  211. package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
  212. package/Shaders/fluidRenderingBilateralBlur.fragment.d.ts +5 -0
  213. package/Shaders/fluidRenderingBilateralBlur.fragment.js +9 -0
  214. package/Shaders/fluidRenderingBilateralBlur.fragment.js.map +1 -0
  215. package/Shaders/fluidRenderingParticleDepth.fragment.d.ts +5 -0
  216. package/Shaders/fluidRenderingParticleDepth.fragment.js +17 -0
  217. package/Shaders/fluidRenderingParticleDepth.fragment.js.map +1 -0
  218. package/Shaders/fluidRenderingParticleDepth.vertex.d.ts +5 -0
  219. package/Shaders/fluidRenderingParticleDepth.vertex.js +13 -0
  220. package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -0
  221. package/Shaders/fluidRenderingParticleDiffuse.fragment.d.ts +5 -0
  222. package/Shaders/fluidRenderingParticleDiffuse.fragment.js +9 -0
  223. package/Shaders/fluidRenderingParticleDiffuse.fragment.js.map +1 -0
  224. package/Shaders/fluidRenderingParticleDiffuse.vertex.d.ts +5 -0
  225. package/Shaders/fluidRenderingParticleDiffuse.vertex.js +4 -0
  226. package/Shaders/fluidRenderingParticleDiffuse.vertex.js.map +1 -0
  227. package/Shaders/fluidRenderingParticleThickness.fragment.d.ts +5 -0
  228. package/Shaders/fluidRenderingParticleThickness.fragment.js +9 -0
  229. package/Shaders/fluidRenderingParticleThickness.fragment.js.map +1 -0
  230. package/Shaders/fluidRenderingParticleThickness.vertex.d.ts +5 -0
  231. package/Shaders/fluidRenderingParticleThickness.vertex.js +9 -0
  232. package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -0
  233. package/Shaders/fluidRenderingRender.fragment.d.ts +5 -0
  234. package/Shaders/fluidRenderingRender.fragment.js +46 -0
  235. package/Shaders/fluidRenderingRender.fragment.js.map +1 -0
  236. package/Shaders/fluidRenderingStandardBlur.fragment.d.ts +5 -0
  237. package/Shaders/fluidRenderingStandardBlur.fragment.js +9 -0
  238. package/Shaders/fluidRenderingStandardBlur.fragment.js.map +1 -0
  239. package/XR/features/WebXRControllerPhysics.d.ts +1 -1
  240. package/XR/features/WebXRControllerPhysics.js +1 -1
  241. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  242. package/XR/features/WebXRHandTracking.js +1 -1
  243. package/XR/features/WebXRHandTracking.js.map +1 -1
  244. package/package.json +1 -1
  245. package/scene.js +6 -1
  246. package/scene.js.map +1 -1
  247. package/sceneComponent.d.ts +3 -0
  248. package/sceneComponent.js +3 -0
  249. package/sceneComponent.js.map +1 -1
  250. package/Physics/Plugins/index.js.map +0 -1
@@ -1,68 +1,7 @@
1
- import type { Nullable } from "../types";
2
- import type { Vector3, Quaternion } from "../Maths/math.vector";
3
- import type { AbstractMesh } from "../Meshes/abstractMesh";
4
- import type { PhysicsImpostor, IPhysicsEnabledObject } from "./physicsImpostor";
5
- import type { PhysicsJoint, IMotorEnabledJoint } from "./physicsJoint";
1
+ import type { Vector3 } from "../Maths/math.vector";
6
2
  import type { PhysicsRaycastResult } from "./physicsRaycastResult";
7
- /**
8
- * Interface used to describe a physics joint
9
- */
10
- export interface PhysicsImpostorJoint {
11
- /** Defines the main impostor to which the joint is linked */
12
- mainImpostor: PhysicsImpostor;
13
- /** Defines the impostor that is connected to the main impostor using this joint */
14
- connectedImpostor: PhysicsImpostor;
15
- /** Defines the joint itself */
16
- joint: PhysicsJoint;
17
- }
18
- /** @internal */
19
- export interface IPhysicsEnginePlugin {
20
- world: any;
21
- name: string;
22
- setGravity(gravity: Vector3): void;
23
- setTimeStep(timeStep: number): void;
24
- getTimeStep(): number;
25
- executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
26
- applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
27
- applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
28
- generatePhysicsBody(impostor: PhysicsImpostor): void;
29
- removePhysicsBody(impostor: PhysicsImpostor): void;
30
- generateJoint(joint: PhysicsImpostorJoint): void;
31
- removeJoint(joint: PhysicsImpostorJoint): void;
32
- isSupported(): boolean;
33
- setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
34
- setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
35
- setLinearVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
36
- setAngularVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
37
- getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
38
- getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
39
- setBodyMass(impostor: PhysicsImpostor, mass: number): void;
40
- getBodyMass(impostor: PhysicsImpostor): number;
41
- getBodyFriction(impostor: PhysicsImpostor): number;
42
- setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
43
- getBodyRestitution(impostor: PhysicsImpostor): number;
44
- setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
45
- getBodyPressure?(impostor: PhysicsImpostor): number;
46
- setBodyPressure?(impostor: PhysicsImpostor, pressure: number): void;
47
- getBodyStiffness?(impostor: PhysicsImpostor): number;
48
- setBodyStiffness?(impostor: PhysicsImpostor, stiffness: number): void;
49
- getBodyVelocityIterations?(impostor: PhysicsImpostor): number;
50
- setBodyVelocityIterations?(impostor: PhysicsImpostor, velocityIterations: number): void;
51
- getBodyPositionIterations?(impostor: PhysicsImpostor): number;
52
- setBodyPositionIterations?(impostor: PhysicsImpostor, positionIterations: number): void;
53
- appendAnchor?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;
54
- appendHook?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;
55
- sleepBody(impostor: PhysicsImpostor): void;
56
- wakeUpBody(impostor: PhysicsImpostor): void;
57
- raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;
58
- updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
59
- setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
60
- setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
61
- getRadius(impostor: PhysicsImpostor): number;
62
- getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
63
- syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
64
- dispose(): void;
65
- }
3
+ import type { IPhysicsEnginePlugin as IPhysicsEnginePluginV1 } from "./v1/IPhysicsEnginePlugin";
4
+ import type { IPhysicsEnginePlugin as IPhysicsEnginePluginV2 } from "./v2/IPhysicsEnginePlugin";
66
5
  /**
67
6
  * Interface used to define a physics engine
68
7
  * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
@@ -72,6 +11,10 @@ export interface IPhysicsEngine {
72
11
  * Gets the gravity vector used by the simulation
73
12
  */
74
13
  gravity: Vector3;
14
+ /**
15
+ *
16
+ */
17
+ getPluginVersion(): number;
75
18
  /**
76
19
  * Sets the gravity vector used by the simulation
77
20
  * @param gravity defines the gravity vector to use
@@ -111,54 +54,11 @@ export interface IPhysicsEngine {
111
54
  * @returns the name of the plugin
112
55
  */
113
56
  getPhysicsPluginName(): string;
114
- /**
115
- * Adding a new impostor for the impostor tracking.
116
- * This will be done by the impostor itself.
117
- * @param impostor the impostor to add
118
- */
119
- addImpostor(impostor: PhysicsImpostor): void;
120
- /**
121
- * Remove an impostor from the engine.
122
- * This impostor and its mesh will not longer be updated by the physics engine.
123
- * @param impostor the impostor to remove
124
- */
125
- removeImpostor(impostor: PhysicsImpostor): void;
126
- /**
127
- * Add a joint to the physics engine
128
- * @param mainImpostor defines the main impostor to which the joint is added.
129
- * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint
130
- * @param joint defines the joint that will connect both impostors.
131
- */
132
- addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
133
- /**
134
- * Removes a joint from the simulation
135
- * @param mainImpostor defines the impostor used with the joint
136
- * @param connectedImpostor defines the other impostor connected to the main one by the joint
137
- * @param joint defines the joint to remove
138
- */
139
- removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
140
57
  /**
141
58
  * Gets the current plugin used to run the simulation
142
59
  * @returns current plugin
143
60
  */
144
- getPhysicsPlugin(): IPhysicsEnginePlugin;
145
- /**
146
- * Gets the list of physic impostors
147
- * @returns an array of PhysicsImpostor
148
- */
149
- getImpostors(): Array<PhysicsImpostor>;
150
- /**
151
- * Gets the impostor for a physics enabled object
152
- * @param object defines the object impersonated by the impostor
153
- * @returns the PhysicsImpostor or null if not found
154
- */
155
- getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor>;
156
- /**
157
- * Gets the impostor for a physics body object
158
- * @param body defines physics body used by the impostor
159
- * @returns the PhysicsImpostor or null if not found
160
- */
161
- getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor>;
61
+ getPhysicsPlugin(): IPhysicsEnginePluginV1 | IPhysicsEnginePluginV2 | null;
162
62
  /**
163
63
  * Does a raycast in the physics world
164
64
  * @param from when should the ray start?
@@ -1 +1 @@
1
- {"version":3,"file":"IPhysicsEngine.js","sourceRoot":"","sources":["../../../../lts/core/generated/Physics/IPhysicsEngine.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Vector3, Quaternion } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { PhysicsImpostor, IPhysicsEnabledObject } from \"./physicsImpostor\";\r\nimport type { PhysicsJoint, IMotorEnabledJoint } from \"./physicsJoint\";\r\nimport type { PhysicsRaycastResult } from \"./physicsRaycastResult\";\r\n\r\n/**\r\n * Interface used to describe a physics joint\r\n */\r\nexport interface PhysicsImpostorJoint {\r\n /** Defines the main impostor to which the joint is linked */\r\n mainImpostor: PhysicsImpostor;\r\n /** Defines the impostor that is connected to the main impostor using this joint */\r\n connectedImpostor: PhysicsImpostor;\r\n /** Defines the joint itself */\r\n joint: PhysicsJoint;\r\n}\r\n\r\n/** @internal */\r\nexport interface IPhysicsEnginePlugin {\r\n world: any;\r\n name: string;\r\n setGravity(gravity: Vector3): void;\r\n setTimeStep(timeStep: number): void;\r\n getTimeStep(): number;\r\n executeStep(delta: number, impostors: Array<PhysicsImpostor>): void; //not forgetting pre and post events\r\n applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;\r\n applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;\r\n generatePhysicsBody(impostor: PhysicsImpostor): void;\r\n removePhysicsBody(impostor: PhysicsImpostor): void;\r\n generateJoint(joint: PhysicsImpostorJoint): void;\r\n removeJoint(joint: PhysicsImpostorJoint): void;\r\n isSupported(): boolean;\r\n setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;\r\n setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;\r\n setLinearVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;\r\n setAngularVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;\r\n getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;\r\n getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;\r\n setBodyMass(impostor: PhysicsImpostor, mass: number): void;\r\n getBodyMass(impostor: PhysicsImpostor): number;\r\n getBodyFriction(impostor: PhysicsImpostor): number;\r\n setBodyFriction(impostor: PhysicsImpostor, friction: number): void;\r\n getBodyRestitution(impostor: PhysicsImpostor): number;\r\n setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;\r\n getBodyPressure?(impostor: PhysicsImpostor): number;\r\n setBodyPressure?(impostor: PhysicsImpostor, pressure: number): void;\r\n getBodyStiffness?(impostor: PhysicsImpostor): number;\r\n setBodyStiffness?(impostor: PhysicsImpostor, stiffness: number): void;\r\n getBodyVelocityIterations?(impostor: PhysicsImpostor): number;\r\n setBodyVelocityIterations?(impostor: PhysicsImpostor, velocityIterations: number): void;\r\n getBodyPositionIterations?(impostor: PhysicsImpostor): number;\r\n setBodyPositionIterations?(impostor: PhysicsImpostor, positionIterations: number): void;\r\n appendAnchor?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;\r\n appendHook?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;\r\n sleepBody(impostor: PhysicsImpostor): void;\r\n wakeUpBody(impostor: PhysicsImpostor): void;\r\n raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;\r\n //Joint Update\r\n updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;\r\n setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;\r\n setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;\r\n getRadius(impostor: PhysicsImpostor): number;\r\n getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;\r\n syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Interface used to define a physics engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface IPhysicsEngine {\r\n /**\r\n * Gets the gravity vector used by the simulation\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Sets the gravity vector used by the simulation\r\n * @param gravity defines the gravity vector to use\r\n */\r\n setGravity(gravity: Vector3): void;\r\n\r\n /**\r\n * Set the time step of the physics engine.\r\n * Default is 1/60.\r\n * To slow it down, enter 1/600 for example.\r\n * To speed it up, 1/30\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number): void;\r\n\r\n /**\r\n * Get the time step of the physics engine.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number;\r\n\r\n /**\r\n * Set the sub time step of the physics engine.\r\n * Default is 0 meaning there is no sub steps\r\n * To increase physics resolution precision, set a small value (like 1 ms)\r\n * @param subTimeStep defines the new sub timestep used for physics resolution.\r\n */\r\n setSubTimeStep(subTimeStep: number): void;\r\n\r\n /**\r\n * Get the sub time step of the physics engine.\r\n * @returns the current sub time step\r\n */\r\n getSubTimeStep(): number;\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n\r\n /**\r\n * Gets the name of the current physics plugin\r\n * @returns the name of the plugin\r\n */\r\n getPhysicsPluginName(): string;\r\n\r\n /**\r\n * Adding a new impostor for the impostor tracking.\r\n * This will be done by the impostor itself.\r\n * @param impostor the impostor to add\r\n */\r\n addImpostor(impostor: PhysicsImpostor): void;\r\n\r\n /**\r\n * Remove an impostor from the engine.\r\n * This impostor and its mesh will not longer be updated by the physics engine.\r\n * @param impostor the impostor to remove\r\n */\r\n removeImpostor(impostor: PhysicsImpostor): void;\r\n\r\n /**\r\n * Add a joint to the physics engine\r\n * @param mainImpostor defines the main impostor to which the joint is added.\r\n * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint\r\n * @param joint defines the joint that will connect both impostors.\r\n */\r\n addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;\r\n\r\n /**\r\n * Removes a joint from the simulation\r\n * @param mainImpostor defines the impostor used with the joint\r\n * @param connectedImpostor defines the other impostor connected to the main one by the joint\r\n * @param joint defines the joint to remove\r\n */\r\n removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;\r\n\r\n /**\r\n * Gets the current plugin used to run the simulation\r\n * @returns current plugin\r\n */\r\n getPhysicsPlugin(): IPhysicsEnginePlugin;\r\n\r\n /**\r\n * Gets the list of physic impostors\r\n * @returns an array of PhysicsImpostor\r\n */\r\n getImpostors(): Array<PhysicsImpostor>;\r\n\r\n /**\r\n * Gets the impostor for a physics enabled object\r\n * @param object defines the object impersonated by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor>;\r\n\r\n /**\r\n * Gets the impostor for a physics body object\r\n * @param body defines physics body used by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor>;\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;\r\n\r\n /**\r\n * Called by the scene. No need to call it.\r\n * @param delta defines the timespan between frames\r\n */\r\n _step(delta: number): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"IPhysicsEngine.js","sourceRoot":"","sources":["../../../../lts/core/generated/Physics/IPhysicsEngine.ts"],"names":[],"mappings":"","sourcesContent":["import type { Vector3 } from \"../Maths/math.vector\";\r\nimport type { PhysicsRaycastResult } from \"./physicsRaycastResult\";\r\nimport type { IPhysicsEnginePlugin as IPhysicsEnginePluginV1 } from \"./v1/IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePlugin as IPhysicsEnginePluginV2 } from \"./v2/IPhysicsEnginePlugin\";\r\n\r\n/**\r\n * Interface used to define a physics engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface IPhysicsEngine {\r\n /**\r\n * Gets the gravity vector used by the simulation\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n *\r\n */\r\n getPluginVersion(): number;\r\n /**\r\n * Sets the gravity vector used by the simulation\r\n * @param gravity defines the gravity vector to use\r\n */\r\n setGravity(gravity: Vector3): void;\r\n\r\n /**\r\n * Set the time step of the physics engine.\r\n * Default is 1/60.\r\n * To slow it down, enter 1/600 for example.\r\n * To speed it up, 1/30\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number): void;\r\n\r\n /**\r\n * Get the time step of the physics engine.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number;\r\n\r\n /**\r\n * Set the sub time step of the physics engine.\r\n * Default is 0 meaning there is no sub steps\r\n * To increase physics resolution precision, set a small value (like 1 ms)\r\n * @param subTimeStep defines the new sub timestep used for physics resolution.\r\n */\r\n setSubTimeStep(subTimeStep: number): void;\r\n\r\n /**\r\n * Get the sub time step of the physics engine.\r\n * @returns the current sub time step\r\n */\r\n getSubTimeStep(): number;\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n\r\n /**\r\n * Gets the name of the current physics plugin\r\n * @returns the name of the plugin\r\n */\r\n getPhysicsPluginName(): string;\r\n\r\n /**\r\n * Gets the current plugin used to run the simulation\r\n * @returns current plugin\r\n */\r\n getPhysicsPlugin(): IPhysicsEnginePluginV1 | IPhysicsEnginePluginV2 | null;\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;\r\n\r\n /**\r\n * Called by the scene. No need to call it.\r\n * @param delta defines the timespan between frames\r\n */\r\n _step(delta: number): void;\r\n}\r\n"]}
@@ -1,389 +1 @@
1
- import { Quaternion, Vector3 } from "../../Maths/math.vector";
2
- import type { IPhysicsEnginePlugin, PhysicsImpostorJoint } from "../../Physics/IPhysicsEngine";
3
- import { PhysicsImpostor } from "../../Physics/physicsImpostor";
4
- import type { IMotorEnabledJoint } from "../../Physics/physicsJoint";
5
- import type { Nullable } from "../../types";
6
- import type { AbstractMesh } from "../../Meshes/abstractMesh";
7
- import { PhysicsRaycastResult } from "../physicsRaycastResult";
8
- /**
9
- * AmmoJS Physics plugin
10
- * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
11
- * @see https://github.com/kripken/ammo.js/
12
- */
13
- export declare class AmmoJSPlugin implements IPhysicsEnginePlugin {
14
- private _useDeltaForWorldStep;
15
- /**
16
- * Reference to the Ammo library
17
- */
18
- bjsAMMO: any;
19
- /**
20
- * Created ammoJS world which physics bodies are added to
21
- */
22
- world: any;
23
- /**
24
- * Name of the plugin
25
- */
26
- name: string;
27
- private _timeStep;
28
- private _fixedTimeStep;
29
- private _maxSteps;
30
- private _tmpQuaternion;
31
- private _tmpAmmoTransform;
32
- private _tmpAmmoQuaternion;
33
- private _tmpAmmoConcreteContactResultCallback;
34
- private _collisionConfiguration;
35
- private _dispatcher;
36
- private _overlappingPairCache;
37
- private _solver;
38
- private _softBodySolver;
39
- private _tmpAmmoVectorA;
40
- private _tmpAmmoVectorB;
41
- private _tmpAmmoVectorC;
42
- private _tmpAmmoVectorD;
43
- private _tmpContactCallbackResult;
44
- private _tmpAmmoVectorRCA;
45
- private _tmpAmmoVectorRCB;
46
- private _raycastResult;
47
- private _tmpContactPoint;
48
- private _tmpContactNormal;
49
- private _tmpContactDistance;
50
- private _tmpContactImpulse;
51
- private _tmpVec3;
52
- private static readonly _DISABLE_COLLISION_FLAG;
53
- private static readonly _KINEMATIC_FLAG;
54
- private static readonly _DISABLE_DEACTIVATION_FLAG;
55
- /**
56
- * Initializes the ammoJS plugin
57
- * @param _useDeltaForWorldStep if the time between frames should be used when calculating physics steps (Default: true)
58
- * @param ammoInjection can be used to inject your own ammo reference
59
- * @param overlappingPairCache can be used to specify your own overlapping pair cache
60
- */
61
- constructor(_useDeltaForWorldStep?: boolean, ammoInjection?: any, overlappingPairCache?: any);
62
- /**
63
- * Sets the gravity of the physics world (m/(s^2))
64
- * @param gravity Gravity to set
65
- */
66
- setGravity(gravity: Vector3): void;
67
- /**
68
- * Amount of time to step forward on each frame (only used if useDeltaForWorldStep is false in the constructor)
69
- * @param timeStep timestep to use in seconds
70
- */
71
- setTimeStep(timeStep: number): void;
72
- /**
73
- * Increment to step forward in the physics engine (If timeStep is set to 1/60 and fixedTimeStep is set to 1/120 the physics engine should run 2 steps per frame) (Default: 1/60)
74
- * @param fixedTimeStep fixedTimeStep to use in seconds
75
- */
76
- setFixedTimeStep(fixedTimeStep: number): void;
77
- /**
78
- * Sets the maximum number of steps by the physics engine per frame (Default: 5)
79
- * @param maxSteps the maximum number of steps by the physics engine per frame
80
- */
81
- setMaxSteps(maxSteps: number): void;
82
- /**
83
- * Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)
84
- * @returns the current timestep in seconds
85
- */
86
- getTimeStep(): number;
87
- /**
88
- * The create custom shape handler function to be called when using BABYLON.PhysicsImposter.CustomImpostor
89
- */
90
- onCreateCustomShape: (impostor: PhysicsImpostor) => any;
91
- /**
92
- * The create custom mesh impostor handler function to support building custom mesh impostor vertex data
93
- */
94
- onCreateCustomMeshImpostor: (impostor: PhysicsImpostor) => any;
95
- /**
96
- * The create custom convex hull impostor handler function to support building custom convex hull impostor vertex data
97
- */
98
- onCreateCustomConvexHullImpostor: (impostor: PhysicsImpostor) => any;
99
- private _isImpostorInContact;
100
- private _isImpostorPairInContact;
101
- private _stepSimulation;
102
- /**
103
- * Moves the physics simulation forward delta seconds and updates the given physics imposters
104
- * Prior to the step the imposters physics location is set to the position of the babylon meshes
105
- * After the step the babylon meshes are set to the position of the physics imposters
106
- * @param delta amount of time to step forward
107
- * @param impostors array of imposters to update before/after the step
108
- */
109
- executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
110
- /**
111
- * Update babylon mesh to match physics world object
112
- * @param impostor imposter to match
113
- */
114
- private _afterSoftStep;
115
- /**
116
- * Update babylon mesh vertices vertices to match physics world softbody or cloth
117
- * @param impostor imposter to match
118
- */
119
- private _ropeStep;
120
- /**
121
- * Update babylon mesh vertices vertices to match physics world softbody or cloth
122
- * @param impostor imposter to match
123
- */
124
- private _softbodyOrClothStep;
125
- private _tmpMatrix;
126
- /**
127
- * Applies an impulse on the imposter
128
- * @param impostor imposter to apply impulse to
129
- * @param force amount of force to be applied to the imposter
130
- * @param contactPoint the location to apply the impulse on the imposter
131
- */
132
- applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
133
- /**
134
- * Applies a force on the imposter
135
- * @param impostor imposter to apply force
136
- * @param force amount of force to be applied to the imposter
137
- * @param contactPoint the location to apply the force on the imposter
138
- */
139
- applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
140
- /**
141
- * Creates a physics body using the plugin
142
- * @param impostor the imposter to create the physics body on
143
- */
144
- generatePhysicsBody(impostor: PhysicsImpostor): void;
145
- /**
146
- * Removes the physics body from the imposter and disposes of the body's memory
147
- * @param impostor imposter to remove the physics body from
148
- */
149
- removePhysicsBody(impostor: PhysicsImpostor): void;
150
- /**
151
- * Generates a joint
152
- * @param impostorJoint the imposter joint to create the joint with
153
- */
154
- generateJoint(impostorJoint: PhysicsImpostorJoint): void;
155
- /**
156
- * Removes a joint
157
- * @param impostorJoint the imposter joint to remove the joint from
158
- */
159
- removeJoint(impostorJoint: PhysicsImpostorJoint): void;
160
- private _addMeshVerts;
161
- /**
162
- * Initialise the soft body vertices to match its object's (mesh) vertices
163
- * Softbody vertices (nodes) are in world space and to match this
164
- * The object's position and rotation is set to zero and so its vertices are also then set in world space
165
- * @param impostor to create the softbody for
166
- */
167
- private _softVertexData;
168
- /**
169
- * Create an impostor's soft body
170
- * @param impostor to create the softbody for
171
- */
172
- private _createSoftbody;
173
- /**
174
- * Create cloth for an impostor
175
- * @param impostor to create the softbody for
176
- */
177
- private _createCloth;
178
- /**
179
- * Create rope for an impostor
180
- * @param impostor to create the softbody for
181
- */
182
- private _createRope;
183
- /**
184
- * Create a custom physics impostor shape using the plugin's onCreateCustomShape handler
185
- * @param impostor to create the custom physics shape for
186
- */
187
- private _createCustom;
188
- private _addHullVerts;
189
- private _createShape;
190
- /**
191
- * Sets the mesh body position/rotation from the babylon impostor
192
- * @param impostor imposter containing the physics body and babylon object
193
- */
194
- setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
195
- /**
196
- * Sets the babylon object's position/rotation from the physics body's position/rotation
197
- * @param impostor imposter containing the physics body and babylon object
198
- * @param newPosition new position
199
- * @param newRotation new rotation
200
- */
201
- setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
202
- /**
203
- * If this plugin is supported
204
- * @returns true if its supported
205
- */
206
- isSupported(): boolean;
207
- /**
208
- * Sets the linear velocity of the physics body
209
- * @param impostor imposter to set the velocity on
210
- * @param velocity velocity to set
211
- */
212
- setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
213
- /**
214
- * Sets the angular velocity of the physics body
215
- * @param impostor imposter to set the velocity on
216
- * @param velocity velocity to set
217
- */
218
- setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
219
- /**
220
- * gets the linear velocity
221
- * @param impostor imposter to get linear velocity from
222
- * @returns linear velocity
223
- */
224
- getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
225
- /**
226
- * gets the angular velocity
227
- * @param impostor imposter to get angular velocity from
228
- * @returns angular velocity
229
- */
230
- getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
231
- /**
232
- * Sets the mass of physics body
233
- * @param impostor imposter to set the mass on
234
- * @param mass mass to set
235
- */
236
- setBodyMass(impostor: PhysicsImpostor, mass: number): void;
237
- /**
238
- * Gets the mass of the physics body
239
- * @param impostor imposter to get the mass from
240
- * @returns mass
241
- */
242
- getBodyMass(impostor: PhysicsImpostor): number;
243
- /**
244
- * Gets friction of the impostor
245
- * @param impostor impostor to get friction from
246
- * @returns friction value
247
- */
248
- getBodyFriction(impostor: PhysicsImpostor): number;
249
- /**
250
- * Sets friction of the impostor
251
- * @param impostor impostor to set friction on
252
- * @param friction friction value
253
- */
254
- setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
255
- /**
256
- * Gets restitution of the impostor
257
- * @param impostor impostor to get restitution from
258
- * @returns restitution value
259
- */
260
- getBodyRestitution(impostor: PhysicsImpostor): number;
261
- /**
262
- * Sets restitution of the impostor
263
- * @param impostor impostor to set resitution on
264
- * @param restitution resitution value
265
- */
266
- setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
267
- /**
268
- * Gets pressure inside the impostor
269
- * @param impostor impostor to get pressure from
270
- * @returns pressure value
271
- */
272
- getBodyPressure(impostor: PhysicsImpostor): number;
273
- /**
274
- * Sets pressure inside a soft body impostor
275
- * Cloth and rope must remain 0 pressure
276
- * @param impostor impostor to set pressure on
277
- * @param pressure pressure value
278
- */
279
- setBodyPressure(impostor: PhysicsImpostor, pressure: number): void;
280
- /**
281
- * Gets stiffness of the impostor
282
- * @param impostor impostor to get stiffness from
283
- * @returns pressure value
284
- */
285
- getBodyStiffness(impostor: PhysicsImpostor): number;
286
- /**
287
- * Sets stiffness of the impostor
288
- * @param impostor impostor to set stiffness on
289
- * @param stiffness stiffness value from 0 to 1
290
- */
291
- setBodyStiffness(impostor: PhysicsImpostor, stiffness: number): void;
292
- /**
293
- * Gets velocityIterations of the impostor
294
- * @param impostor impostor to get velocity iterations from
295
- * @returns velocityIterations value
296
- */
297
- getBodyVelocityIterations(impostor: PhysicsImpostor): number;
298
- /**
299
- * Sets velocityIterations of the impostor
300
- * @param impostor impostor to set velocity iterations on
301
- * @param velocityIterations velocityIterations value
302
- */
303
- setBodyVelocityIterations(impostor: PhysicsImpostor, velocityIterations: number): void;
304
- /**
305
- * Gets positionIterations of the impostor
306
- * @param impostor impostor to get position iterations from
307
- * @returns positionIterations value
308
- */
309
- getBodyPositionIterations(impostor: PhysicsImpostor): number;
310
- /**
311
- * Sets positionIterations of the impostor
312
- * @param impostor impostor to set position on
313
- * @param positionIterations positionIterations value
314
- */
315
- setBodyPositionIterations(impostor: PhysicsImpostor, positionIterations: number): void;
316
- /**
317
- * Append an anchor to a cloth object
318
- * @param impostor is the cloth impostor to add anchor to
319
- * @param otherImpostor is the rigid impostor to anchor to
320
- * @param width ratio across width from 0 to 1
321
- * @param height ratio up height from 0 to 1
322
- * @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little stretch
323
- * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false
324
- */
325
- appendAnchor(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean): void;
326
- /**
327
- * Append an hook to a rope object
328
- * @param impostor is the rope impostor to add hook to
329
- * @param otherImpostor is the rigid impostor to hook to
330
- * @param length ratio along the rope from 0 to 1
331
- * @param influence the elasticity between soft impostor and anchor from 0, very stretchy to 1, little stretch
332
- * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false
333
- */
334
- appendHook(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean): void;
335
- /**
336
- * Sleeps the physics body and stops it from being active
337
- * @param impostor impostor to sleep
338
- */
339
- sleepBody(impostor: PhysicsImpostor): void;
340
- /**
341
- * Activates the physics body
342
- * @param impostor impostor to activate
343
- */
344
- wakeUpBody(impostor: PhysicsImpostor): void;
345
- /**
346
- * Updates the distance parameters of the joint
347
- */
348
- updateDistanceJoint(): void;
349
- /**
350
- * Sets a motor on the joint
351
- * @param joint joint to set motor on
352
- * @param speed speed of the motor
353
- * @param maxForce maximum force of the motor
354
- */
355
- setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number): void;
356
- /**
357
- * Sets the motors limit
358
- */
359
- setLimit(): void;
360
- /**
361
- * Syncs the position and rotation of a mesh with the impostor
362
- * @param mesh mesh to sync
363
- * @param impostor impostor to update the mesh with
364
- */
365
- syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
366
- /**
367
- * Gets the radius of the impostor
368
- * @param impostor impostor to get radius from
369
- * @returns the radius
370
- */
371
- getRadius(impostor: PhysicsImpostor): number;
372
- /**
373
- * Gets the box size of the impostor
374
- * @param impostor impostor to get box size from
375
- * @param result the resulting box size
376
- */
377
- getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
378
- /**
379
- * Disposes of the impostor
380
- */
381
- dispose(): void;
382
- /**
383
- * Does a raycast in the physics world
384
- * @param from where should the ray start?
385
- * @param to where should the ray end?
386
- * @returns PhysicsRaycastResult
387
- */
388
- raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;
389
- }
1
+ export * from "../v1/Plugins/ammoJSPlugin";