Categories
Game Development

Quaternion from A to B

I couldn’t figure out how to get the quaternion representing the rotation from A to B. Laugh if you want but I don’t use Quaternions enough to remember and have to reinvent the wheel every time. 20 minutes later of looking at Real-Time rendering // start * delta = final // start^-1 * start * […]

I couldn’t figure out how to get the quaternion representing the rotation from A to B. Laugh if you want but I don’t use Quaternions enough to remember and have to reinvent the wheel every time.

20 minutes later of looking at Real-Time rendering

// start * delta = final
// start^-1 * start * delta = start^-1 * final
// delta = start^-1 * final

The inverse of a quaternion q is conjugate(q) / length(q)^2

For a unit quaternion, the length is 1.

For the conjugate, flip the sign of x,y, and z.

Leave a Reply

Your email address will not be published. Required fields are marked *