Skip to content

Commit

Permalink
fix: upon entering sketch mode, axis do not rotate. (#4572)
Browse files Browse the repository at this point in the history
* fix: upon entering sketch mode, axis do not rotate.

* fix: camera settings has the up vector to set, this should now work
  • Loading branch information
nadr0 authored and jessfraz committed Dec 5, 2024
1 parent fb35565 commit f07a0d3
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/clientSideScene/CameraControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,26 @@ export class CameraControls {
camSettings.center.y,
camSettings.center.z
)
const quat = new Quaternion(
const orientation = new Quaternion(
camSettings.orientation.x,
camSettings.orientation.y,
camSettings.orientation.z,
camSettings.orientation.w
).invert()

this.camera.up.copy(new Vector3(0, 1, 0).applyQuaternion(quat))
const newUp = new Vector3(
camSettings.up.x,
camSettings.up.y,
camSettings.up.z
)
this.camera.quaternion.set(
orientation.x,
orientation.y,
orientation.z,
orientation.w
)
this.camera.up.copy(newUp)
this.camera.updateProjectionMatrix()
if (this.camera instanceof PerspectiveCamera && camSettings.ortho) {
this.useOrthographicCamera()
}
Expand Down Expand Up @@ -1164,14 +1176,15 @@ export class CameraControls {
this.camera.updateProjectionMatrix()
}

if (this.syncDirection === 'clientToEngine' || forceUpdate)
if (this.syncDirection === 'clientToEngine' || forceUpdate) {
this.throttledUpdateEngineCamera({
quaternion: this.camera.quaternion,
position: this.camera.position,
zoom: this.camera.zoom,
isPerspective: this.isPerspective,
target: this.target,
})
}
this.deferReactUpdate(this.reactCameraProperties)
Object.values(this._camChangeCallbacks).forEach((cb) => cb())
}
Expand Down

0 comments on commit f07a0d3

Please sign in to comment.