Skip to content

Commit

Permalink
Fix initial camera rotation (#165)
Browse files Browse the repository at this point in the history
* Fix initial camera rotation

* Simplified initial CameraManager properties
  • Loading branch information
MarcusLongmuir authored Jul 24, 2024
1 parent c5bc6e3 commit 81deb84
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/3d-web-client-core/src/camera/CameraManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export class CameraManager {
public targetDistance: number = this.initialDistance;
public desiredDistance: number = this.initialDistance;

private phi: number = Math.PI / 2;
private targetPhi: number = this.phi;
private theta: number = Math.PI / 2;
private targetTheta: number = this.theta;
private phi: number;
private targetPhi: number;
private theta: number;
private targetTheta: number;

private target: Vector3 = new Vector3(0, 1.55, 0);
private hadTarget: boolean = false;
Expand All @@ -63,7 +63,9 @@ export class CameraManager {
) {
this.targetElement.style.touchAction = "pinch-zoom";
this.phi = initialPhi;
this.targetPhi = this.phi;
this.theta = initialTheta;
this.targetTheta = this.theta;
this.camera = new PerspectiveCamera(this.fov, window.innerWidth / window.innerHeight, 0.1, 400);
this.camera.position.set(0, 1.4, -this.initialDistance);
this.rayCaster = new Raycaster();
Expand Down

0 comments on commit 81deb84

Please sign in to comment.