Eww mutable state

This commit is contained in:
Tony Garnock-Jones 2023-01-09 14:47:38 +01:00
parent 16ed2a012e
commit e886bb1f4d
3 changed files with 6 additions and 9 deletions

View File

@ -36,12 +36,9 @@
<Exit "ball" "other">
<sprite "ball"
<move <v 0.0 1.5 2.0>
<scale <v 1.0 1.0 1.0>
<color 0.0 1.0 0.0
<floor
<touchable
<sphere>>>>>>>
<move <v 0.0 1.5 3.0>
<color 0.0 1.0 0.0
<touchable <sphere>>>>>
<sprite "plans"
<texture ["plans/signal-2022-12-27-125451_002.jpeg"]

View File

@ -122,7 +122,7 @@ export class RunningEngine {
this.camera = this.xr.baseExperience.camera;
} else {
this.camera = new FreeCamera("camera",
this.options.initialPos,
this.options.initialPos.clone(),
this.scene);
this.camera.rotation = this.options.initialRotation;
this.camera.minZ = 0.1;
@ -256,7 +256,7 @@ export class RunningEngine {
xrEnable() {
if (!this.xrSessionManager) return;
this.xr.baseExperience.enterXRAsync('immersive-vr', 'local').then(() => {
this.xr.baseExperience.camera.position = this.options.initialPos;
this.xr.baseExperience.camera.position = this.options.initialPos.clone();
this.xr.baseExperience.camera.rotation = this.options.initialRotation;
this.xr.baseExperience.sessionManager.session.onselect = () => this.xrTeleport();
});

View File

@ -66,7 +66,7 @@ async function enterScene(
const camera = runningEngine.camera;
camera.applyGravity = false;
camera.position = runningEngine.options.initialPos;
camera.position = runningEngine.options.initialPos.clone();
let lastTouchTime = 0;
let lastTouchSpriteName = "";