Skip to content

Commit

Permalink
fix(Controls): replace deprecated THREE.Quaternion.slerp.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoqueux committed Apr 27, 2021
1 parent 082d22c commit 2e27408
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Controls/PlanarControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,9 @@ class PlanarControls extends THREE.EventDispatcher {

// new rotation
if (travelUseRotation === true) {
THREE.Quaternion.slerp(
this.camera.quaternion.slerpQuaternions(
travelStartRot,
travelEndRot,
this.camera.quaternion,
alpha,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/StreetControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class StreetControls extends FirstPersonControls {
})
.onUpdate((d) => {
// 'manually' slerp the Quaternion to avoid rotation issues
THREE.Quaternion.slerp(startQuaternion, this.end.quaternion, this.camera.quaternion, d.t);
this.camera.quaternion.slerpQuaternions(startQuaternion, this.end.quaternion, d.t);
})
.start();

Expand Down
4 changes: 2 additions & 2 deletions src/Utils/CameraUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ class CameraRig extends THREE.Object3D {
.onUpdate((d) => {
// rotate to coord destination in geocentric projection
if (view.referenceCrs == 'EPSG:4978') {
THREE.Quaternion.slerp(this.start.quaternion, this.end.quaternion, this.quaternion, d.t);
this.quaternion.slerpQuaternions(this.start.quaternion, this.end.quaternion, d.t);
}
// camera rotation
THREE.Quaternion.slerp(this.start.camera.quaternion, this.end.camera.quaternion, this.camera.quaternion, d.t);
this.camera.quaternion.slerpQuaternions(this.start.camera.quaternion, this.end.camera.quaternion, d.t);
// camera's target rotation
this.target.rotation.set(0, 0, 0);
this.target.rotateZ(THREE.MathUtils.lerp(this.start.target.rotation.z, this.end.target.rotation.z, d.t));
Expand Down

0 comments on commit 2e27408

Please sign in to comment.