Hey,
I’d like some help with Quaternions. I want an object to rotate around its own local axes, using offsets. So, say offsetRotation = (0, 360, 0), I want the object to rotate 360 degrees around its local Y axis.
What I’m having trouble with is calculating the target rotation. I can get the startRotation using:
this.entity.getLocalRotation()
I can also convert the offsets to Quaternions using:
this.targetRotation.setFromEulerAngles(this.offsetRotation.x, this.offsetRotation.y, this.offsetRotation.z);
But to get the actual targetRotation, I have to offset the startRotation by the offset quaternion, in its local space. I just can’t figure out how to do this…
When it’s all done, I should be able to use:
rot.slerp( this.startRotation, this.targetRotation, this.percent );
Here’s the project, where you can see some of my attempts: https://playcanvas.com/editor/scene/725066