Rotate around local axis using slerp


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:


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:

If you just rotating around the axis, you should be able to modify the w component as that represents the angle around the axis.

I can’t remember if the engine uses degrees or radians.

You can always use the world space rotation instead?