diff --git a/app/pages/PageEnigma/js/editor.ts b/app/pages/PageEnigma/js/editor.ts index 1f56d11c63..28ff42c3c7 100644 --- a/app/pages/PageEnigma/js/editor.ts +++ b/app/pages/PageEnigma/js/editor.ts @@ -380,6 +380,7 @@ class Editor { this.orbitControls.enabled = false; this.cameraViewControls.enabled = false; } + this.cameraViewControls?.reset(); } }); @@ -520,6 +521,7 @@ class Editor { switchCameraView() { this.camera_person_mode = !this.camera_person_mode; + this.cameraViewControls?.reset(); if (this.cam_obj) { if (this.camera_person_mode) { this.last_cam_pos.copy(this.camera.position); diff --git a/app/pages/PageEnigma/js/free_cam.js b/app/pages/PageEnigma/js/free_cam.js index 6fd1e8007c..bb916b24ac 100644 --- a/app/pages/PageEnigma/js/free_cam.js +++ b/app/pages/PageEnigma/js/free_cam.js @@ -112,11 +112,24 @@ class FreeCam extends EventDispatcher { }; + this.reset = function() { + this.moveState.forward = 0; + this.moveState.back = 0; + this.moveState.left = 0; + this.moveState.right = 0; + this.moveState.pitchUp = 0; + this.moveState.pitchDown = 0; + this.moveState.yawLeft = 0; + this.moveState.yawRight = 0; + this.moveState.down = 0; + this.moveState.up = 0; + this.updateMovementVector(); + } + this.update = function ( delta ) { if ( this.enabled === false ) return; - const moveMult = delta * scope.movementSpeed; scope.object.translateX( scope.moveVector.x * moveMult );