@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
@@ -0,0 +1,158 @@
1
+ /**
2
+ *
3
+ */
4
+ /** @internal */
5
+ export class PhysicsBody {
6
+ /**
7
+ *
8
+ * @param scene
9
+ * @returns
10
+ */
11
+ constructor(scene) {
12
+ /** @internal */
13
+ this._pluginData = undefined;
14
+ if (!scene) {
15
+ return;
16
+ }
17
+ const physicsEngine = scene.getPhysicsEngine();
18
+ if (!physicsEngine) {
19
+ throw new Error("No Physics Engine available.");
20
+ }
21
+ if (physicsEngine.getPluginVersion() != 2) {
22
+ throw new Error("Plugin version is incorrect. Expected version 2.");
23
+ }
24
+ const physicsPlugin = physicsEngine.getPhysicsPlugin();
25
+ if (!physicsPlugin) {
26
+ throw new Error("No Physics Plugin available.");
27
+ }
28
+ this._physicsPlugin = physicsPlugin;
29
+ this._physicsPlugin.initBody(this);
30
+ }
31
+ /**
32
+ *
33
+ * @param shape
34
+ */
35
+ setShape(shape) {
36
+ this._physicsPlugin.setShape(this, shape);
37
+ }
38
+ /**
39
+ *
40
+ * @returns
41
+ */
42
+ getShape() {
43
+ return this._physicsPlugin.getShape(this);
44
+ }
45
+ /**
46
+ *
47
+ * @param group
48
+ */
49
+ setFilterGroup(group) {
50
+ this._physicsPlugin.setFilterGroup(this, group);
51
+ }
52
+ /**
53
+ *
54
+ * @returns
55
+ */
56
+ getFilterGroup() {
57
+ return this._physicsPlugin.getFilterGroup(this);
58
+ }
59
+ /**
60
+ *
61
+ * @param eventMask
62
+ */
63
+ setEventMask(eventMask) {
64
+ this._physicsPlugin.setEventMask(this, eventMask);
65
+ }
66
+ /**
67
+ *
68
+ * @returns
69
+ */
70
+ getEventMask() {
71
+ return this._physicsPlugin.getEventMask(this);
72
+ }
73
+ /**
74
+ *
75
+ * @param massProps
76
+ */
77
+ setMassProperties(massProps) {
78
+ this._physicsPlugin.setMassProperties(this, massProps);
79
+ }
80
+ /**
81
+ *
82
+ * @returns
83
+ */
84
+ getMassProperties() {
85
+ return this._physicsPlugin.getMassProperties(this);
86
+ }
87
+ /**
88
+ *
89
+ * @param damping
90
+ */
91
+ setLinearDamping(damping) {
92
+ this._physicsPlugin.setLinearDamping(this, damping);
93
+ }
94
+ /**
95
+ *
96
+ * @returns
97
+ */
98
+ getLinearDamping() {
99
+ return this._physicsPlugin.getLinearDamping(this);
100
+ }
101
+ /**
102
+ *
103
+ * @param damping
104
+ */
105
+ setAngularDamping(damping) {
106
+ this._physicsPlugin.setAngularDamping(this, damping);
107
+ }
108
+ /**
109
+ *
110
+ * @returns
111
+ */
112
+ getAngularDamping() {
113
+ return this._physicsPlugin.getAngularDamping(this);
114
+ }
115
+ /**
116
+ *
117
+ * @param linVel
118
+ */
119
+ setLinearVelocity(linVel) {
120
+ this._physicsPlugin.setLinearVelocity(this, linVel);
121
+ }
122
+ /**
123
+ *
124
+ * @returns
125
+ */
126
+ getLinearVelocityToRef(linVel) {
127
+ return this._physicsPlugin.getLinearVelocityToRef(this, linVel);
128
+ }
129
+ /**
130
+ *
131
+ * @param angVel
132
+ */
133
+ setAngularVelocity(angVel) {
134
+ this._physicsPlugin.setAngularVelocity(this, angVel);
135
+ }
136
+ /**
137
+ *
138
+ * @returns
139
+ */
140
+ getAngularVelocityToRef(angVel) {
141
+ return this._physicsPlugin.getAngularVelocityToRef(this, angVel);
142
+ }
143
+ /**
144
+ *
145
+ * @param location
146
+ * @param impulse
147
+ */
148
+ applyImpulse(location, impulse) {
149
+ this._physicsPlugin.applyImpulse(this, location, impulse);
150
+ }
151
+ /**
152
+ *
153
+ */
154
+ dispose() {
155
+ this._physicsPlugin.disposeBody(this);
156
+ }
157
+ }
158
+ //# sourceMappingURL=physicsBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"physicsBody.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsBody.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,gBAAgB;AAChB,MAAM,OAAO,WAAW;IAMpB;;;;OAIG;IACH,YAAY,KAAY;QAVxB,gBAAgB;QACT,gBAAW,GAAQ,SAAS,CAAC;QAUhC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACnD;QACD,IAAI,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACvE;QACD,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;QACvD,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,cAAc,GAAG,aAAqC,CAAC;QAC5D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IACD;;;OAGG;IACI,QAAQ,CAAC,KAAmB;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACI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C;IAED;;;OAGG;IACI,iBAAiB,CAAC,MAAe;QACpC,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,sBAAsB,CAAC,MAAe;QACzC,OAAO,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACI,kBAAkB,CAAC,MAAe;QACrC,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACI,uBAAuB,CAAC,MAAe;QAC1C,OAAO,IAAI,CAAC,cAAc,CAAC,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,QAAiB,EAAE,OAAgB;QACnD,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["import type { IPhysicsEnginePlugin, MassProperties } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsShape } from \"./physicsShape\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsBody {\r\n /** @internal */\r\n public _pluginData: any = undefined;\r\n\r\n private _physicsPlugin: IPhysicsEnginePlugin;\r\n\r\n /**\r\n *\r\n * @param scene\r\n * @returns\r\n */\r\n constructor(scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePlugin;\r\n this._physicsPlugin.initBody(this);\r\n }\r\n /**\r\n *\r\n * @param shape\r\n */\r\n public setShape(shape: PhysicsShape): void {\r\n this._physicsPlugin.setShape(this, shape);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getShape(): PhysicsShape | undefined {\r\n return this._physicsPlugin.getShape(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param group\r\n */\r\n public setFilterGroup(group: number): void {\r\n this._physicsPlugin.setFilterGroup(this, group);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getFilterGroup(): number {\r\n return this._physicsPlugin.getFilterGroup(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param eventMask\r\n */\r\n public setEventMask(eventMask: number): void {\r\n this._physicsPlugin.setEventMask(this, eventMask);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getEventMask(): number {\r\n return this._physicsPlugin.getEventMask(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param massProps\r\n */\r\n public setMassProperties(massProps: MassProperties): void {\r\n this._physicsPlugin.setMassProperties(this, massProps);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getMassProperties(): MassProperties | undefined {\r\n return this._physicsPlugin.getMassProperties(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param damping\r\n */\r\n public setLinearDamping(damping: number): void {\r\n this._physicsPlugin.setLinearDamping(this, damping);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getLinearDamping(): number {\r\n return this._physicsPlugin.getLinearDamping(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param damping\r\n */\r\n public setAngularDamping(damping: number): void {\r\n this._physicsPlugin.setAngularDamping(this, damping);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getAngularDamping(): number {\r\n return this._physicsPlugin.getAngularDamping(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param linVel\r\n */\r\n public setLinearVelocity(linVel: Vector3): void {\r\n this._physicsPlugin.setLinearVelocity(this, linVel);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getLinearVelocityToRef(linVel: Vector3): void {\r\n return this._physicsPlugin.getLinearVelocityToRef(this, linVel);\r\n }\r\n\r\n /**\r\n *\r\n * @param angVel\r\n */\r\n public setAngularVelocity(angVel: Vector3): void {\r\n this._physicsPlugin.setAngularVelocity(this, angVel);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getAngularVelocityToRef(angVel: Vector3): void {\r\n return this._physicsPlugin.getAngularVelocityToRef(this, angVel);\r\n }\r\n\r\n /**\r\n *\r\n * @param location\r\n * @param impulse\r\n */\r\n public applyImpulse(location: Vector3, impulse: Vector3): void {\r\n this._physicsPlugin.applyImpulse(this, location, impulse);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public dispose() {\r\n this._physicsPlugin.disposeBody(this);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,184 @@
1
+ import type { Scene } from "../../scene";
2
+ import type { Vector3 } from "../../Maths/math.vector";
3
+ import type { IPhysicsEnginePlugin, ConstraintAxis, PhysicsConstraintParameters, ConstraintAxisLimitMode, ConstraintMotorType } from "./IPhysicsEnginePlugin";
4
+ import { ConstraintType } from "./IPhysicsEnginePlugin";
5
+ import type { PhysicsBody } from "./physicsBody";
6
+ /**
7
+ * This is a holder class for the physics constraint created by the physics plugin
8
+ * It holds a set of functions to control the underlying constraint
9
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
10
+ */
11
+ /** @internal */
12
+ export declare class PhysicsConstraint {
13
+ /** @internal */
14
+ /**
15
+ *
16
+ */
17
+ _pluginData: any;
18
+ protected _physicsPlugin: IPhysicsEnginePlugin;
19
+ /**
20
+ *
21
+ */
22
+ constructor(type: ConstraintType, options: PhysicsConstraintParameters, scene: Scene);
23
+ /**
24
+ *
25
+ * @param body
26
+ */
27
+ setParentBody(body: PhysicsBody): void;
28
+ /**
29
+ *
30
+ * @returns
31
+ */
32
+ getParentBody(): PhysicsBody | undefined;
33
+ /**
34
+ *
35
+ * @param body
36
+ */
37
+ setChildBody(body: PhysicsBody): void;
38
+ /**
39
+ *
40
+ * @returns
41
+ */
42
+ getChildBody(): PhysicsBody | undefined;
43
+ /**
44
+ *
45
+ * @param pivot +
46
+ * @param axisX
47
+ * @param axisY
48
+ */
49
+ setAnchorInParent(pivot: Vector3, axisX: Vector3, axisY: Vector3): void;
50
+ /**
51
+ *
52
+ * @param pivot
53
+ * @param axisX
54
+ * @param axisY
55
+ */
56
+ setAnchorInChild(pivot: Vector3, axisX: Vector3, axisY: Vector3): void;
57
+ /**
58
+ *
59
+ * @param isEnabled
60
+ */
61
+ setEnabled(isEnabled: boolean): void;
62
+ /**
63
+ *
64
+ * @returns
65
+ */
66
+ getEnabled(): boolean;
67
+ /**
68
+ *
69
+ * @param isEnabled
70
+ */
71
+ setCollisionsEnabled(isEnabled: boolean): void;
72
+ /**
73
+ *
74
+ * @returns
75
+ */
76
+ getCollisionsEnabled(): boolean;
77
+ /**
78
+ *
79
+ * @param axis
80
+ * @param friction
81
+ */
82
+ setAxisFriction(axis: ConstraintAxis, friction: number): void;
83
+ /**
84
+ *
85
+ * @param axis
86
+ * @returns
87
+ */
88
+ getAxisFriction(axis: ConstraintAxis): number;
89
+ /**
90
+ *
91
+ * @param axis
92
+ * @param limitMode
93
+ */
94
+ setAxisMode(axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void;
95
+ /**
96
+ *
97
+ * @param axis
98
+ */
99
+ getAxisMode(axis: ConstraintAxis): ConstraintAxisLimitMode;
100
+ /**
101
+ *
102
+ */
103
+ setAxisMinLimit(axis: ConstraintAxis, minLimit: number): void;
104
+ /**
105
+ *
106
+ */
107
+ getAxisMinLimit(axis: ConstraintAxis): number;
108
+ /**
109
+ *
110
+ */
111
+ setAxisMaxLimit(axis: ConstraintAxis, limit: number): void;
112
+ /**
113
+ *
114
+ */
115
+ getAxisMaxLimit(axis: ConstraintAxis): number;
116
+ /**
117
+ *
118
+ */
119
+ setAxisMotorType(axis: ConstraintAxis, motorType: ConstraintMotorType): void;
120
+ /**
121
+ *
122
+ */
123
+ getAxisMotorType(axis: ConstraintAxis): ConstraintMotorType;
124
+ /**
125
+ *
126
+ */
127
+ setAxisMotorTarget(axis: ConstraintAxis, target: number): void;
128
+ /**
129
+ *
130
+ */
131
+ getAxisMotorTarget(axis: ConstraintAxis): number;
132
+ /**
133
+ *
134
+ */
135
+ setAxisMotorMaxForce(axis: ConstraintAxis, maxForce: number): void;
136
+ /**
137
+ *
138
+ */
139
+ getAxisMotorMaxForce(axis: ConstraintAxis): number;
140
+ /**
141
+ *
142
+ */
143
+ dispose(): void;
144
+ }
145
+ /**
146
+ *
147
+ */
148
+ /** @internal */
149
+ export declare class PhysicsConstraintBallAndSocket extends PhysicsConstraint {
150
+ /** @internal */
151
+ constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
152
+ }
153
+ /**
154
+ *
155
+ */
156
+ /** @internal */
157
+ export declare class PhysicsConstraintDistance extends PhysicsConstraint {
158
+ /** @internal */
159
+ constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
160
+ }
161
+ /**
162
+ *
163
+ */
164
+ /** @internal */
165
+ export declare class PhysicsConstraintHinge extends PhysicsConstraint {
166
+ /** @internal */
167
+ constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
168
+ }
169
+ /**
170
+ *
171
+ */
172
+ /** @internal */
173
+ export declare class PhysicsConstraintSlider extends PhysicsConstraint {
174
+ /** @internal */
175
+ constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
176
+ }
177
+ /**
178
+ *
179
+ */
180
+ /** @internal */
181
+ export declare class PhysicsConstraintLock extends PhysicsConstraint {
182
+ /** @internal */
183
+ constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
184
+ }
@@ -0,0 +1,257 @@
1
+ import { ConstraintType } from "./IPhysicsEnginePlugin.js";
2
+ /**
3
+ * This is a holder class for the physics constraint created by the physics plugin
4
+ * It holds a set of functions to control the underlying constraint
5
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
6
+ */
7
+ /** @internal */
8
+ export class PhysicsConstraint {
9
+ /**
10
+ *
11
+ */
12
+ constructor(type, options, scene) {
13
+ /** @internal */
14
+ /**
15
+ *
16
+ */
17
+ this._pluginData = undefined;
18
+ if (!scene) {
19
+ return;
20
+ }
21
+ const physicsEngine = scene.getPhysicsEngine();
22
+ if (!physicsEngine) {
23
+ throw new Error("No Physics Engine available.");
24
+ }
25
+ if (physicsEngine.getPluginVersion() != 2) {
26
+ throw new Error("Plugin version is incorrect. Expected version 2.");
27
+ }
28
+ const physicsPlugin = physicsEngine.getPhysicsPlugin();
29
+ if (!physicsPlugin) {
30
+ throw new Error("No Physics Plugin available.");
31
+ }
32
+ this._physicsPlugin = physicsPlugin;
33
+ this._physicsPlugin.initConstraint(this, type, options);
34
+ }
35
+ /**
36
+ *
37
+ * @param body
38
+ */
39
+ setParentBody(body) {
40
+ this._physicsPlugin.setParentBody(this, body);
41
+ }
42
+ /**
43
+ *
44
+ * @returns
45
+ */
46
+ getParentBody() {
47
+ return this._physicsPlugin.getParentBody(this);
48
+ }
49
+ /**
50
+ *
51
+ * @param body
52
+ */
53
+ setChildBody(body) {
54
+ this._physicsPlugin.setChildBody(this, body);
55
+ }
56
+ /**
57
+ *
58
+ * @returns
59
+ */
60
+ getChildBody() {
61
+ return this._physicsPlugin.getChildBody(this);
62
+ }
63
+ /**
64
+ *
65
+ * @param pivot +
66
+ * @param axisX
67
+ * @param axisY
68
+ */
69
+ setAnchorInParent(pivot, axisX, axisY) {
70
+ this._physicsPlugin.setAnchorInParent(this, pivot, axisX, axisY);
71
+ }
72
+ /**
73
+ *
74
+ * @param pivot
75
+ * @param axisX
76
+ * @param axisY
77
+ */
78
+ setAnchorInChild(pivot, axisX, axisY) {
79
+ this._physicsPlugin.setAnchorInChild(this, pivot, axisX, axisY);
80
+ }
81
+ /**
82
+ *
83
+ * @param isEnabled
84
+ */
85
+ setEnabled(isEnabled) {
86
+ this._physicsPlugin.setEnabled(this, isEnabled);
87
+ }
88
+ /**
89
+ *
90
+ * @returns
91
+ */
92
+ getEnabled() {
93
+ return this._physicsPlugin.getEnabled(this);
94
+ }
95
+ /**
96
+ *
97
+ * @param isEnabled
98
+ */
99
+ setCollisionsEnabled(isEnabled) {
100
+ this._physicsPlugin.setCollisionsEnabled(this, isEnabled);
101
+ }
102
+ /**
103
+ *
104
+ * @returns
105
+ */
106
+ getCollisionsEnabled() {
107
+ return this._physicsPlugin.getCollisionsEnabled(this);
108
+ }
109
+ /**
110
+ *
111
+ * @param axis
112
+ * @param friction
113
+ */
114
+ setAxisFriction(axis, friction) {
115
+ this._physicsPlugin.setAxisFriction(this, axis, friction);
116
+ }
117
+ /**
118
+ *
119
+ * @param axis
120
+ * @returns
121
+ */
122
+ getAxisFriction(axis) {
123
+ return this._physicsPlugin.getAxisFriction(this, axis);
124
+ }
125
+ /**
126
+ *
127
+ * @param axis
128
+ * @param limitMode
129
+ */
130
+ setAxisMode(axis, limitMode) {
131
+ this._physicsPlugin.setAxisMode(this, axis, limitMode);
132
+ }
133
+ /**
134
+ *
135
+ * @param axis
136
+ */
137
+ getAxisMode(axis) {
138
+ return this._physicsPlugin.getAxisMode(this, axis);
139
+ }
140
+ /**
141
+ *
142
+ */
143
+ setAxisMinLimit(axis, minLimit) {
144
+ this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);
145
+ }
146
+ /**
147
+ *
148
+ */
149
+ getAxisMinLimit(axis) {
150
+ return this._physicsPlugin.getAxisMinLimit(this, axis);
151
+ }
152
+ /**
153
+ *
154
+ */
155
+ setAxisMaxLimit(axis, limit) {
156
+ this._physicsPlugin.setAxisMaxLimit(this, axis, limit);
157
+ }
158
+ /**
159
+ *
160
+ */
161
+ getAxisMaxLimit(axis) {
162
+ return this._physicsPlugin.getAxisMaxLimit(this, axis);
163
+ }
164
+ /**
165
+ *
166
+ */
167
+ setAxisMotorType(axis, motorType) {
168
+ this._physicsPlugin.setAxisMotorType(this, axis, motorType);
169
+ }
170
+ /**
171
+ *
172
+ */
173
+ getAxisMotorType(axis) {
174
+ return this._physicsPlugin.getAxisMotorType(this, axis);
175
+ }
176
+ /**
177
+ *
178
+ */
179
+ setAxisMotorTarget(axis, target) {
180
+ this._physicsPlugin.setAxisMotorTarget(this, axis, target);
181
+ }
182
+ /**
183
+ *
184
+ */
185
+ getAxisMotorTarget(axis) {
186
+ return this._physicsPlugin.getAxisMotorTarget(this, axis);
187
+ }
188
+ /**
189
+ *
190
+ */
191
+ setAxisMotorMaxForce(axis, maxForce) {
192
+ this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);
193
+ }
194
+ /**
195
+ *
196
+ */
197
+ getAxisMotorMaxForce(axis) {
198
+ return this._physicsPlugin.getAxisMotorMaxForce(this, axis);
199
+ }
200
+ /**
201
+ *
202
+ */
203
+ dispose() {
204
+ this._physicsPlugin.disposeConstraint(this);
205
+ }
206
+ }
207
+ /**
208
+ *
209
+ */
210
+ /** @internal */
211
+ export class PhysicsConstraintBallAndSocket extends PhysicsConstraint {
212
+ /** @internal */
213
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
214
+ super(ConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
215
+ }
216
+ }
217
+ /**
218
+ *
219
+ */
220
+ /** @internal */
221
+ export class PhysicsConstraintDistance extends PhysicsConstraint {
222
+ /** @internal */
223
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
224
+ super(ConstraintType.DISTANCE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
225
+ }
226
+ }
227
+ /**
228
+ *
229
+ */
230
+ /** @internal */
231
+ export class PhysicsConstraintHinge extends PhysicsConstraint {
232
+ /** @internal */
233
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
234
+ super(ConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
235
+ }
236
+ }
237
+ /**
238
+ *
239
+ */
240
+ /** @internal */
241
+ export class PhysicsConstraintSlider extends PhysicsConstraint {
242
+ /** @internal */
243
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
244
+ super(ConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
245
+ }
246
+ }
247
+ /**
248
+ *
249
+ */
250
+ /** @internal */
251
+ export class PhysicsConstraintLock extends PhysicsConstraint {
252
+ /** @internal */
253
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
254
+ super(ConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
255
+ }
256
+ }
257
+ //# sourceMappingURL=physicsConstraint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"physicsConstraint.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsConstraint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD;;;;GAIG;AACH,gBAAgB;AAChB,MAAM,OAAO,iBAAiB;IAQ1B;;OAEG;IACH,YAAY,IAAoB,EAAE,OAAoC,EAAE,KAAY;QAVpF,gBAAgB;QAChB;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAOhC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,MAAM,aAAa,GAAG,KAAK,CAAC,gBAA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E,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,KAAY;QACtF,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACxG,CAAC;CACJ;AAED;;GAEG;AACH,gBAAgB;AAChB,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IACxD,gBAAgB;IAChB,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,KAAY;QACtF,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACtG,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { IPhysicsEnginePlugin, ConstraintAxis, PhysicsConstraintParameters, ConstraintAxisLimitMode, ConstraintMotorType } from \"./IPhysicsEnginePlugin\";\r\nimport { ConstraintType } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\n\r\n/**\r\n * This is a holder class for the physics constraint created by the physics plugin\r\n * It holds a set of functions to control the underlying constraint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraint {\r\n /** @internal */\r\n /**\r\n *\r\n */\r\n public _pluginData: any = undefined;\r\n protected _physicsPlugin: IPhysicsEnginePlugin;\r\n\r\n /**\r\n *\r\n */\r\n constructor(type: ConstraintType, options: PhysicsConstraintParameters, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePlugin;\r\n this._physicsPlugin.initConstraint(this, type, options);\r\n }\r\n\r\n /**\r\n *\r\n * @param body\r\n */\r\n public setParentBody(body: PhysicsBody): void {\r\n this._physicsPlugin.setParentBody(this, body);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getParentBody(): PhysicsBody | undefined {\r\n return this._physicsPlugin.getParentBody(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param body\r\n */\r\n public setChildBody(body: PhysicsBody): void {\r\n this._physicsPlugin.setChildBody(this, body);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getChildBody(): PhysicsBody | undefined {\r\n return this._physicsPlugin.getChildBody(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param pivot +\r\n * @param axisX\r\n * @param axisY\r\n */\r\n public setAnchorInParent(pivot: Vector3, axisX: Vector3, axisY: Vector3): void {\r\n this._physicsPlugin.setAnchorInParent(this, pivot, axisX, axisY);\r\n }\r\n\r\n /**\r\n *\r\n * @param pivot\r\n * @param axisX\r\n * @param axisY\r\n */\r\n public setAnchorInChild(pivot: Vector3, axisX: Vector3, axisY: Vector3): void {\r\n this._physicsPlugin.setAnchorInChild(this, pivot, axisX, axisY);\r\n }\r\n\r\n /**\r\n *\r\n * @param isEnabled\r\n */\r\n public setEnabled(isEnabled: boolean): void {\r\n this._physicsPlugin.setEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getEnabled(): boolean {\r\n return this._physicsPlugin.getEnabled(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param isEnabled\r\n */\r\n public setCollisionsEnabled(isEnabled: boolean): void {\r\n this._physicsPlugin.setCollisionsEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getCollisionsEnabled(): boolean {\r\n return this._physicsPlugin.getCollisionsEnabled(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param axis\r\n * @param friction\r\n */\r\n public setAxisFriction(axis: ConstraintAxis, friction: number): void {\r\n this._physicsPlugin.setAxisFriction(this, axis, friction);\r\n }\r\n\r\n /**\r\n *\r\n * @param axis\r\n * @returns\r\n */\r\n public getAxisFriction(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisFriction(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n * @param axis\r\n * @param limitMode\r\n */\r\n public setAxisMode(axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void {\r\n this._physicsPlugin.setAxisMode(this, axis, limitMode);\r\n }\r\n /**\r\n *\r\n * @param axis\r\n */\r\n public getAxisMode(axis: ConstraintAxis): ConstraintAxisLimitMode {\r\n return this._physicsPlugin.getAxisMode(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMinLimit(axis: ConstraintAxis, minLimit: number): void {\r\n this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMinLimit(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMinLimit(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMaxLimit(axis: ConstraintAxis, limit: number): void {\r\n this._physicsPlugin.setAxisMaxLimit(this, axis, limit);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMaxLimit(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMaxLimit(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMotorType(axis: ConstraintAxis, motorType: ConstraintMotorType): void {\r\n this._physicsPlugin.setAxisMotorType(this, axis, motorType);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMotorType(axis: ConstraintAxis): ConstraintMotorType {\r\n return this._physicsPlugin.getAxisMotorType(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMotorTarget(axis: ConstraintAxis, target: number): void {\r\n this._physicsPlugin.setAxisMotorTarget(this, axis, target);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMotorTarget(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMotorTarget(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMotorMaxForce(axis: ConstraintAxis, maxForce: number): void {\r\n this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMotorMaxForce(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMotorMaxForce(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.disposeConstraint(this);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintBallAndSocket extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintDistance extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.DISTANCE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintHinge extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintSlider extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintLock extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n"]}