How can I simulate a planet's rotation on the Z axis but tilted x° ( similar to how the Earth's rotation axis is tilted 23° relative to its orbit).

I know with Euler angles I'll meet some gimbal lock issues, so I'm looking for a quaternion solution.

This video illustrates what I'm trying to do.


Ended up doing something like that in my update :

SpinAngle += deltaTime * Speed;
Quaternion rotationAboutAxis = Quaternion.Euler(0, SpinAngle, 0);
Quaternion tiltOfAxis = Quaternion.Euler(0, 0, TiltAngle);
transform.rotation = tiltOfAxis * rotationAboutAxis ;

Where TiltAngle is in degree :) Thanks !


1 Answer 1


You can just compose the quaternions.

// Rotate by spinAngle degrees about our local z+ axis.
var rotationAboutAxis = Quaternion.Euler(0, 0, spinAngle);

// Tilt the object's z+ spin axis by tiltAngle on the parent/world x+ axis.
var tiltOfAxis = Quaternion.Euler(tiltAngle, 0, 0);

transform.rotation = tiltOfAxis * rotationAboutAxis;

Put whatever rotation you want to be "more local" to the right side of the multiplication, and whatever rotation you want to be "more global" to the left side.

  • \$\begingroup\$ So If I get it well ... With that the spin angle need to be properly updated each frame to be able to rotate :) \$\endgroup\$
    – Slater
    Commented May 2, 2022 at 19:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .