@series-inc/rundot-3d-engine 0.5.14 → 0.5.16

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.
@@ -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.syncObjectToPhysics(mesh, rigidBody);
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
  }
@@ -2557,7 +2562,9 @@ var DEFAULT_CONFIG = {
2557
2562
  shadowMapType: "vsm",
2558
2563
  toneMapping: "aces",
2559
2564
  toneMappingExposure: 1,
2560
- audioEnabled: true
2565
+ audioEnabled: true,
2566
+ cameraType: "perspective",
2567
+ orthoSize: 10
2561
2568
  };
2562
2569
  var VenusGame = class _VenusGame {
2563
2570
  // Static references for global access
@@ -2745,19 +2752,47 @@ var VenusGame = class _VenusGame {
2745
2752
  this.applyRenderingConfig();
2746
2753
  this.scene = new THREE7.Scene();
2747
2754
  this.scene.background = new THREE7.Color(this.config.backgroundColor);
2748
- this.camera = new THREE7.PerspectiveCamera(
2749
- 75,
2750
- // fov
2751
- window.innerWidth / window.innerHeight,
2752
- // aspect
2753
- 0.1,
2754
- // near
2755
- 1e3
2756
- // far
2757
- );
2755
+ if (this.config.cameraType === "orthographic") {
2756
+ const aspect = window.innerWidth / window.innerHeight;
2757
+ const size = this.config.orthoSize;
2758
+ this.camera = new THREE7.OrthographicCamera(
2759
+ -size * aspect,
2760
+ // left
2761
+ size * aspect,
2762
+ // right
2763
+ size,
2764
+ // top
2765
+ -size,
2766
+ // bottom
2767
+ 0.1,
2768
+ // near
2769
+ 1e3
2770
+ // far
2771
+ );
2772
+ } else {
2773
+ this.camera = new THREE7.PerspectiveCamera(
2774
+ 75,
2775
+ // fov
2776
+ window.innerWidth / window.innerHeight,
2777
+ // aspect
2778
+ 0.1,
2779
+ // near
2780
+ 1e3
2781
+ // far
2782
+ );
2783
+ }
2758
2784
  this.clock = new THREE7.Clock();
2759
2785
  this.resizeListener = () => {
2760
- this.camera.aspect = window.innerWidth / window.innerHeight;
2786
+ const aspect = window.innerWidth / window.innerHeight;
2787
+ if (this.camera instanceof THREE7.PerspectiveCamera) {
2788
+ this.camera.aspect = aspect;
2789
+ } else if (this.camera instanceof THREE7.OrthographicCamera) {
2790
+ const size = this.config.orthoSize;
2791
+ this.camera.left = -size * aspect;
2792
+ this.camera.right = size * aspect;
2793
+ this.camera.top = size;
2794
+ this.camera.bottom = -size;
2795
+ }
2761
2796
  this.camera.updateProjectionMatrix();
2762
2797
  this.renderer.setSize(window.innerWidth, window.innerHeight);
2763
2798
  let maxPixelRatio2;
@@ -6110,4 +6145,4 @@ export {
6110
6145
  PrefabLoader,
6111
6146
  StowKitSystem
6112
6147
  };
6113
- //# sourceMappingURL=chunk-F7S64ACG.js.map
6148
+ //# sourceMappingURL=chunk-SQK4CPRB.js.map