|
@@ -3,7 +3,7 @@ import { serialize, serializeAsMeshReference } from "../Misc/decorators";
|
|
|
import { Tools } from "../Misc/tools";
|
|
|
import { TargetCamera } from "./targetCamera";
|
|
|
import { Scene } from "../scene";
|
|
|
-import { Matrix, Vector3 } from "../Maths/math.vector";
|
|
|
+import { TmpVectors, Vector3 } from "../Maths/math.vector";
|
|
|
import { Node } from "../node";
|
|
|
import { AbstractMesh } from "../Meshes/abstractMesh";
|
|
|
import { FollowCameraInputsManager } from './followCameraInputsManager';
|
|
@@ -130,14 +130,10 @@ export class FollowCamera extends TargetCamera {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var yRotation;
|
|
|
- if (cameraTarget.rotationQuaternion) {
|
|
|
- var rotMatrix = new Matrix();
|
|
|
- cameraTarget.rotationQuaternion.toRotationMatrix(rotMatrix);
|
|
|
- yRotation = Math.atan2(rotMatrix.m[8], rotMatrix.m[10]);
|
|
|
- } else {
|
|
|
- yRotation = cameraTarget.rotation.y;
|
|
|
- }
|
|
|
+ var rotMatrix = TmpVectors.Matrix[0];
|
|
|
+ cameraTarget.absoluteRotationQuaternion.toRotationMatrix(rotMatrix);
|
|
|
+ var yRotation = Math.atan2(rotMatrix.m[8], rotMatrix.m[10]);
|
|
|
+
|
|
|
var radians = Tools.ToRadians(this.rotationOffset) + yRotation;
|
|
|
var targetPosition = cameraTarget.getAbsolutePosition();
|
|
|
var targetX: number = targetPosition.x + Math.sin(radians) * this.radius;
|