|
@@ -15,6 +15,9 @@ export class TargetCamera extends Camera {
|
|
|
private static _TargetTransformMatrix = new Matrix();
|
|
|
private static _TargetFocalPoint = new Vector3();
|
|
|
|
|
|
+ private _tmpUpVector = Vector3.Zero();
|
|
|
+ private _tmpTargetVector = Vector3.Zero();
|
|
|
+
|
|
|
/**
|
|
|
* Define the current direction the camera is moving to
|
|
|
*/
|
|
@@ -23,6 +26,11 @@ export class TargetCamera extends Camera {
|
|
|
* Define the current rotation the camera is rotating to
|
|
|
*/
|
|
|
public cameraRotation = new Vector2(0, 0);
|
|
|
+
|
|
|
+
|
|
|
+ /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */
|
|
|
+ public ignoreParentScaling = false;
|
|
|
+
|
|
|
/**
|
|
|
* When set, the up vector of the camera will be updated by the rotation of the camera
|
|
|
*/
|
|
@@ -421,6 +429,27 @@ export class TargetCamera extends Camera {
|
|
|
}
|
|
|
|
|
|
protected _computeViewMatrix(position: Vector3, target: Vector3, up: Vector3): void {
|
|
|
+ if (this.ignoreParentScaling) {
|
|
|
+ if (this.parent) {
|
|
|
+ const parentWorldMatrix = this.parent.getWorldMatrix();
|
|
|
+ Vector3.TransformCoordinatesToRef(position, parentWorldMatrix, this._globalPosition);
|
|
|
+ Vector3.TransformCoordinatesToRef(target, parentWorldMatrix, this._tmpTargetVector);
|
|
|
+ Vector3.TransformNormalToRef(up, parentWorldMatrix, this._tmpUpVector);
|
|
|
+ this._markSyncedWithParent();
|
|
|
+ } else {
|
|
|
+ this._globalPosition.copyFrom(position);
|
|
|
+ this._tmpTargetVector.copyFrom(target);
|
|
|
+ this._tmpUpVector.copyFrom(up);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
+ Matrix.LookAtRHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);
|
|
|
+ } else {
|
|
|
+ Matrix.LookAtLHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (this.getScene().useRightHandedSystem) {
|
|
|
Matrix.LookAtRHToRef(position, target, up, this._viewMatrix);
|
|
|
} else {
|