@multitapio/multitap 0.0.7 → 0.0.8

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/lib.js CHANGED
@@ -9522,7 +9522,8 @@ var MobaView = {
9522
9522
 
9523
9523
  // src/react/views/AsteroidsView.ts
9524
9524
  import { Quaternion as Quaternion14, Vector3 as Vector314 } from "three";
9525
- var DEFAULT_HEIGHT8 = 50;
9525
+ var DEFAULT_DISTANCE8 = 50;
9526
+ var DEFAULT_ANGLE3 = Math.PI / 2;
9526
9527
  var DEFAULT_ROTATION_SENSITIVITY = 4;
9527
9528
  var DEFAULT_FOLLOW_SPEED5 = 10;
9528
9529
  var UP = new Vector314(0, 1, 0);
@@ -9570,7 +9571,8 @@ var AsteroidsView = {
9570
9571
  },
9571
9572
  applyToCamera(state, ctx) {
9572
9573
  const { position, pivot, camera, delta, props } = ctx;
9573
- const height = props.cameraDistance ?? DEFAULT_HEIGHT8;
9574
+ const distance = props.cameraDistance ?? DEFAULT_DISTANCE8;
9575
+ const angle = props.cameraAngle ?? DEFAULT_ANGLE3;
9574
9576
  const damping = props.damping ?? 0;
9575
9577
  const clampedDamping = Math.min(damping, 0.99);
9576
9578
  const followSpeed = clampedDamping > 0 ? DEFAULT_FOLLOW_SPEED5 * (1 - clampedDamping) : Infinity;
@@ -9582,8 +9584,11 @@ var AsteroidsView = {
9582
9584
  pivot.position.lerp(targetPosition5, t);
9583
9585
  }
9584
9586
  pivot.rotation.set(0, 0, 0);
9585
- camera.position.set(0, height, 0);
9586
- camera.rotation.set(-Math.PI / 2, 0, 0);
9587
+ const pitchFromHorizontal = Math.PI / 2 - angle;
9588
+ const y = Math.sin(pitchFromHorizontal) * distance;
9589
+ const horizontalDistance = Math.cos(pitchFromHorizontal) * distance;
9590
+ camera.position.set(0, y, horizontalDistance);
9591
+ camera.rotation.set(-pitchFromHorizontal, 0, 0);
9587
9592
  }
9588
9593
  };
9589
9594
 
@@ -1 +1 @@
1
- {"version":3,"file":"AsteroidsView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/AsteroidsView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAC;AAgB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,EAAE,IAwF3B,CAAC"}
1
+ {"version":3,"file":"AsteroidsView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/AsteroidsView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAC;AAmB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,EAAE,IA8F3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AsteroidsView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/AsteroidsView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAC;AAgB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,EAAE,IAwF3B,CAAC"}
1
+ {"version":3,"file":"AsteroidsView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/AsteroidsView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAC;AAmB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,EAAE,IA8F3B,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@multitapio/multitap",
3
3
  "type": "module",
4
- "version": "0.0.7",
4
+ "version": "0.0.8",
5
5
  "description": "Rollback networking SDK for fast-paced multiplayer games",
6
6
  "main": "./dist/lib.js",
7
7
  "types": "./dist/lib.d.ts",