From 7b3f0dac77c768c0d5cc252649e61b9c6016b77d Mon Sep 17 00:00:00 2001 From: Gheric Speiginer Date: Thu, 27 Jun 2024 14:12:42 -0700 Subject: [PATCH] Update FollowCameraComponent.ts --- .../src/camera/components/FollowCameraComponent.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/spatial/src/camera/components/FollowCameraComponent.ts b/packages/spatial/src/camera/components/FollowCameraComponent.ts index 3cd5a3c2de..90e29b7c58 100755 --- a/packages/spatial/src/camera/components/FollowCameraComponent.ts +++ b/packages/spatial/src/camera/components/FollowCameraComponent.ts @@ -356,15 +356,15 @@ const computeCameraFollow = (cameraEntity: Entity, referenceEntity: Entity) => { const thetaRad = MathUtils.degToRad(theta) const phiRad = MathUtils.degToRad(follow.phi) + direction.set(Math.sin(thetaRad) * Math.cos(phiRad), Math.sin(phiRad), Math.cos(thetaRad) * Math.cos(phiRad)) + cameraTransform.position.set( - follow.currentTargetPosition.x + follow.distance * Math.sin(thetaRad) * Math.cos(phiRad), - follow.currentTargetPosition.y + follow.distance * Math.sin(phiRad), - follow.currentTargetPosition.z + follow.distance * Math.cos(thetaRad) * Math.cos(phiRad) + follow.currentTargetPosition.x + follow.distance * direction.x, + follow.currentTargetPosition.y + follow.distance * direction.y, + follow.currentTargetPosition.z + follow.distance * direction.z ) - direction.copy(cameraTransform.position).sub(follow.currentTargetPosition).normalize() mx.lookAt(direction, empty, upVector) - cameraTransform.rotation.setFromRotationMatrix(mx) updateCameraTargetRotation(cameraEntity)