Hi, this is somewhat embarressing because i cant even do this:
On Button click rotate an instance in a camera rig by 90 degrees.
I usually set up a camera rig such as:
containerentity: Used for positioning/centering
- yrotationEntity: rotated around y (left/right)
– x rotation entity: rotate around x (angle up/down)
— camera: (use position z to zoom)
But i can´t come up with a tween solution around Y by 90 degrees. Some success is with the first rotation, after that it jumps back. I guess i run in gimbal lock, although i tried converting eulers to Quat.
RotationManager.prototype.onRelease = function (event) {
if ( this.isTweened == true) {
return;
}
this.isTweened = true;
var rot = this.YrotRigNode.getLocalRotation();
var targetEulers = this.YrotRigNode.getLocalEulerAngles().clone();
targetEulers.y += 90;
console.log("y rotation center = " + this.YrotRigNode.name);
this.rotQuaternion.setFromEulerAngles(targetEulers.x, targetEulers.y, targetEulers.z);
var tweenRot = this.app.tween(rot).to(this.rotQuaternion, 5, pc.SineInOut);
tweenRot.on('update', function (dt) {
this.YrotRigNode.setLocalRotation(rot);
}.bind(this));
tweenRot.on('complete', function () {
console.log('rot tween complete');
this.isTweened = false;
}.bind(this));
tweenRot.start();
};