|
@@ -27681,7 +27681,7 @@ var BABYLON;
|
|
|
* @param animatable defines an animatable object. If not provided a new one will be created from the given params
|
|
|
* @param stopCurrent defines if the current animations must be stopped first (true by default)
|
|
|
* @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)
|
|
|
- * @returns the animatable object created for this animation
|
|
|
+ * @returns the list of created animatables
|
|
|
*/
|
|
|
Scene.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask) {
|
|
|
if (speedRatio === void 0) { speedRatio = 1.0; }
|
|
@@ -48717,6 +48717,11 @@ var BABYLON;
|
|
|
*/
|
|
|
_this.cameraRotation = new BABYLON.Vector2(0, 0);
|
|
|
/**
|
|
|
+ * When set, the up vector of the camera will be updated by the rotation of the camera
|
|
|
+ */
|
|
|
+ _this.updateUpVectorFromRotation = false;
|
|
|
+ _this._tmpQuaternion = new BABYLON.Quaternion();
|
|
|
+ /**
|
|
|
* Define the current rotation of the camera
|
|
|
*/
|
|
|
_this.rotation = new BABYLON.Vector3(0, 0, 0);
|
|
@@ -48991,6 +48996,15 @@ var BABYLON;
|
|
|
BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
|
|
|
// Computing target and final matrix
|
|
|
this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
|
|
|
+ if (this.updateUpVectorFromRotation) {
|
|
|
+ if (this.rotationQuaternion) {
|
|
|
+ BABYLON.Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ BABYLON.Quaternion.FromEulerVectorToRef(this.rotation, this._tmpQuaternion);
|
|
|
+ BABYLON.Axis.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);
|
|
|
+ }
|
|
|
+ }
|
|
|
this._computeViewMatrix(this.position, this._currentTarget, this.upVector);
|
|
|
return this._viewMatrix;
|
|
|
};
|
|
@@ -107780,6 +107794,16 @@ var BABYLON;
|
|
|
}
|
|
|
if (this._scene.activeCamera) {
|
|
|
this._position = this._scene.activeCamera.position.clone();
|
|
|
+ if (this.vrDeviceOrientationCamera) {
|
|
|
+ this.vrDeviceOrientationCamera.rotation = BABYLON.Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles();
|
|
|
+ }
|
|
|
+ if (this.webVRCamera) {
|
|
|
+ var currentYRotation = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y;
|
|
|
+ var desiredYRotation = BABYLON.Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y;
|
|
|
+ var delta = desiredYRotation - currentYRotation;
|
|
|
+ var currentGlobalRotation = this.webVRCamera.rotationQuaternion.toEulerAngles().y;
|
|
|
+ this.webVRCamera.rotationQuaternion = BABYLON.Quaternion.FromEulerAngles(0, currentGlobalRotation + delta, 0);
|
|
|
+ }
|
|
|
// make sure that we return to the last active camera
|
|
|
this._existingCamera = this._scene.activeCamera;
|
|
|
}
|
|
@@ -108625,6 +108649,7 @@ var BABYLON;
|
|
|
_this.minZ = 0;
|
|
|
_this.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
_this.cameraRigMode = BABYLON.Camera.RIG_MODE_CUSTOM;
|
|
|
+ _this.updateUpVectorFromRotation = true;
|
|
|
_this._updateNumberOfRigCameras(1);
|
|
|
return _this;
|
|
|
}
|