@series-inc/rundot-3d-engine 0.5.14 → 0.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-F7S64ACG.js → chunk-JD4M2BHR.js} +9 -4
- package/dist/chunk-JD4M2BHR.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/systems/index.d.ts +24 -2
- package/dist/systems/index.js +284 -238
- package/dist/systems/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-F7S64ACG.js.map +0 -1
|
@@ -245,11 +245,15 @@ var PhysicsSystem = class _PhysicsSystem {
|
|
|
245
245
|
/**
|
|
246
246
|
* Sync Three.js object position with physics body
|
|
247
247
|
*/
|
|
248
|
-
static syncObjectToPhysics(object, rigidBody) {
|
|
248
|
+
static syncObjectToPhysics(object, rigidBody, collider) {
|
|
249
249
|
const translation = rigidBody.translation();
|
|
250
250
|
const rotation = rigidBody.rotation();
|
|
251
251
|
object.position.set(translation.x, translation.y, translation.z);
|
|
252
252
|
object.quaternion.set(rotation.x, rotation.y, rotation.z, rotation.w);
|
|
253
|
+
if (collider) {
|
|
254
|
+
const ct = collider.translation();
|
|
255
|
+
object.position.set(ct.x, ct.y, ct.z);
|
|
256
|
+
}
|
|
253
257
|
}
|
|
254
258
|
/**
|
|
255
259
|
* Sync physics body position to Three.js object
|
|
@@ -382,7 +386,7 @@ var PhysicsSystem = class _PhysicsSystem {
|
|
|
382
386
|
debugMesh.name = `debug_${id}`;
|
|
383
387
|
const rigidBody = _PhysicsSystem.rigidBodies.get(id);
|
|
384
388
|
if (rigidBody) {
|
|
385
|
-
_PhysicsSystem.syncObjectToPhysics(debugMesh, rigidBody);
|
|
389
|
+
_PhysicsSystem.syncObjectToPhysics(debugMesh, rigidBody, collider);
|
|
386
390
|
}
|
|
387
391
|
return debugMesh;
|
|
388
392
|
}
|
|
@@ -442,7 +446,8 @@ var PhysicsSystem = class _PhysicsSystem {
|
|
|
442
446
|
if (rigidBody) {
|
|
443
447
|
const isEnabled = rigidBody.isEnabled();
|
|
444
448
|
if (isEnabled) {
|
|
445
|
-
_PhysicsSystem.
|
|
449
|
+
const collider = _PhysicsSystem.colliders.get(id);
|
|
450
|
+
_PhysicsSystem.syncObjectToPhysics(mesh, rigidBody, collider ?? void 0);
|
|
446
451
|
if (!_PhysicsSystem.debugScene.children.includes(mesh)) {
|
|
447
452
|
_PhysicsSystem.debugScene.add(mesh);
|
|
448
453
|
}
|
|
@@ -6110,4 +6115,4 @@ export {
|
|
|
6110
6115
|
PrefabLoader,
|
|
6111
6116
|
StowKitSystem
|
|
6112
6117
|
};
|
|
6113
|
-
//# sourceMappingURL=chunk-
|
|
6118
|
+
//# sourceMappingURL=chunk-JD4M2BHR.js.map
|