1
$\begingroup$

I was unsure whether it would be best to post this in Physics, Maths, or other forums, so please say if this question is suited better elsewhere.

I am trying trying to create a physics engine for a game that makes makes use of Euler's equation of motion for 3D rigid body rotation. In order to do so, I needed to describe the orientation with a set of three angles. The choice I first made was using Euler angles. This seemed okay in theory, but I started to realise a problem with this whenever I tried to use Euler's equation.

Euler's equation is expressed in terms of angular velocities about the principal axes (1,2,3) of the rotating body, and these angular velocities are equal to:

$$\omega_1 = \dot\theta\sin{\psi}-\dot\phi\sin{\theta}\cos{\psi}$$ $$\omega_2 = \dot\theta\cos{\psi}-\dot\phi\sin{\theta}\sin{\psi}$$ $$\omega_3 = \dot\psi + \dot\phi\cos{\theta}$$

(Note: a z-y-z convention for the Euler angles have been adopted)

Whenever you eliminate $\dot\theta$ from the first two equations, you get:

$$\dot\phi = \frac{\omega_2 \sin{\psi} - \omega_1 \cos{\psi}}{\sin{\theta}}$$

This means for $\theta \rightarrow 0$, the precession rate, $\dot\phi$, goes to infinity, and infinity really isn't too healthy for my simulation.

So, is there an alternative angle system that bypasses this? Have I overlooked something that solves this issue? I'm sure this has been solved before as there are plenty of video games that have 3D rotation without anything crashing!

$\endgroup$
0

1 Answer 1

2
$\begingroup$

You are running into the problem known as gimbal lock which is avoided by using quaternion notation (which incidentally allows for very fast calculation of rotation - it is the standard for video games etc).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.