|
@@ -17,7 +17,6 @@ module BABYLON {
|
|
|
private _oldSize: BABYLON.Size;
|
|
|
private _oldHardwareScaleFactor: number;
|
|
|
|
|
|
- private _initialQuaternion: Quaternion;
|
|
|
private _quaternionCache: Quaternion;
|
|
|
|
|
|
constructor(name: string, position: Vector3, scene: Scene, compensateDistortion = true, vrCameraMetrics: VRCameraMetrics = VRCameraMetrics.GetDefault(), private webVROptions: WebVROptions = {}) {
|
|
@@ -78,10 +77,6 @@ module BABYLON {
|
|
|
//Flip in XY plane
|
|
|
this.rotationQuaternion.z *= -1;
|
|
|
this.rotationQuaternion.w *= -1;
|
|
|
- if (this._initialQuaternion) {
|
|
|
- this._quaternionCache.copyFrom(this.rotationQuaternion);
|
|
|
- this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -115,24 +110,10 @@ module BABYLON {
|
|
|
return "WebVRFreeCamera";
|
|
|
}
|
|
|
|
|
|
- public resetToCurrentRotation(axis: BABYLON.Axis = BABYLON.Axis.Y) {
|
|
|
- //can only work if this camera has a rotation quaternion already.
|
|
|
- if (!this.rotationQuaternion) return;
|
|
|
-
|
|
|
- if (!this._initialQuaternion) {
|
|
|
- this._initialQuaternion = new BABYLON.Quaternion();
|
|
|
- }
|
|
|
-
|
|
|
- this._initialQuaternion.copyFrom(this._quaternionCache || this.rotationQuaternion);
|
|
|
-
|
|
|
- ['x', 'y', 'z'].forEach((axisName) => {
|
|
|
- if (!axis[axisName]) {
|
|
|
- this._initialQuaternion[axisName] = 0;
|
|
|
- } else {
|
|
|
- this._initialQuaternion[axisName] *= -1;
|
|
|
- }
|
|
|
- });
|
|
|
- this._initialQuaternion.normalize();
|
|
|
+ public resetToCurrentRotation() {
|
|
|
+ //uses the vrDisplay's "resetPose()".
|
|
|
+ //pitch and roll won't be affected.
|
|
|
+ this._vrDevice.resetPose();
|
|
|
}
|
|
|
}
|
|
|
}
|