|
@@ -87,9 +87,6 @@ export class TargetCamera extends Camera {
|
|
/** @hidden */
|
|
/** @hidden */
|
|
public _transformedReferencePoint = Vector3.Zero();
|
|
public _transformedReferencePoint = Vector3.Zero();
|
|
|
|
|
|
- protected _globalCurrentTarget = Vector3.Zero();
|
|
|
|
- protected _globalCurrentUpVector = Vector3.Zero();
|
|
|
|
-
|
|
|
|
/** @hidden */
|
|
/** @hidden */
|
|
public _reset: () => void;
|
|
public _reset: () => void;
|
|
|
|
|
|
@@ -424,22 +421,21 @@ export class TargetCamera extends Camera {
|
|
}
|
|
}
|
|
|
|
|
|
protected _computeViewMatrix(position: Vector3, target: Vector3, up: Vector3): void {
|
|
protected _computeViewMatrix(position: Vector3, target: Vector3, up: Vector3): void {
|
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
|
+ Matrix.LookAtRHToRef(position, target, up, this._viewMatrix);
|
|
|
|
+ } else {
|
|
|
|
+ Matrix.LookAtLHToRef(position, target, up, this._viewMatrix);
|
|
|
|
+ }
|
|
|
|
+
|
|
if (this.parent) {
|
|
if (this.parent) {
|
|
const parentWorldMatrix = this.parent.getWorldMatrix();
|
|
const parentWorldMatrix = this.parent.getWorldMatrix();
|
|
- Vector3.TransformCoordinatesToRef(position, parentWorldMatrix, this._globalPosition);
|
|
|
|
- Vector3.TransformCoordinatesToRef(target, parentWorldMatrix, this._globalCurrentTarget);
|
|
|
|
- Vector3.TransformNormalToRef(up, parentWorldMatrix, this._globalCurrentUpVector);
|
|
|
|
|
|
+ this._viewMatrix.invert();
|
|
|
|
+ this._viewMatrix.multiplyToRef(parentWorldMatrix, this._viewMatrix);
|
|
|
|
+ this._viewMatrix.getTranslationToRef(this._globalPosition);
|
|
|
|
+ this._viewMatrix.invert();
|
|
this._markSyncedWithParent();
|
|
this._markSyncedWithParent();
|
|
} else {
|
|
} else {
|
|
this._globalPosition.copyFrom(position);
|
|
this._globalPosition.copyFrom(position);
|
|
- this._globalCurrentTarget.copyFrom(target);
|
|
|
|
- this._globalCurrentUpVector.copyFrom(up);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (this.getScene().useRightHandedSystem) {
|
|
|
|
- Matrix.LookAtRHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix);
|
|
|
|
- } else {
|
|
|
|
- Matrix.LookAtLHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|