Hello,
i would like to reset the transformations done by a pointer input to a model via an animation but I cant seem to figure out which properties of the scene are being used for the pointer based rotation.
Here is playground example: https://www.babylonjs-playground.com/#BYNTRS
After loading the model, a rotation animation starts.
when the user drags the object around the animation stops and starts again after the POINTERUP event.
However I would like the model to rotate back also on each axis to the initial view.
I guess the pointer drags and rotates a different object then the one i am animating?
Thank you.
Well I am actually trying to figure out what I am rotating
In my code I use the scene.meshes[0] as the target for the auto-rotation.
But What element is rotated by the pointer? the scene itself?
You are cause you call in attachControl so by default the camera answers to the pointers. If you want to use the mesh manually, you can disable the attachControl like here:
Hello:
this is a follow up to my question:
The rotation works nicely and now i am trying to reset the model’s rotation via an animation when the user is idle for a certain time.
For that I create an animation with:
new BABYLON.Animation('rotation_animation', 'rotation', 60, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_RELATIVE);
What confuses me a bit:
In the pointer code the rotation is done with:
Thank you.
It does indeed.
Do I need to convert the units, or can I animate rotationQuaternion?
Since in the final version there will be different models can the behaviour be changed, or is it embedded in the model?
The rotate function will animate the rotationQuaternion without any issues.
You could the behavior by setting rotation to rotationQuaternion.toEulerAngles() and then setting the rotationQuaternion to null but I would advise against it if you could end up in gimbal lock situations: Gimbal lock - Wikipedia