Quaternion in Game Development.

Hi,

I am new here. I have a quick questions.
How come most of the books that I have read use matrix for game development, not quaternion?
Is quaternion the fastest way to work with today?

Thanks.

Well you still need a normal matrix for many other applications. Quaternions are only good for rotation

I keep thinking that it can replace many things in the matrix. Are you sure that it is only good for the rotation part of the matrix?

Yep

Technically, you can also use a quaternion to represent scaling.
But this complicates everything else, since any rotation transformations can only be meaningfully performed on unit quaternions. So if you work with non-unit quaternions to represent scaling, whenever you want to apply a rotation to it, you would have to normalize it (requires a square root), do the rotation transformation, and then scale back again by the original length.

I see. That was what I found from reading Jmonkey basic tutorial as well.

Thank you so much.

On quaternions and scaling…yeah probably not worthwhile computationally. The math’s all wrong though. The issue is if you convert to a matrix…the conversion code is assuming that it’s a unit quaternion.

Oh, you’re right. Thanks! That was a good hint. I gotta go change some code…
Representing uniform scaling in a quaternion works nicely when the conversion as layed out here is used (the matrix representation right before the sentence “since qwqw + qxqx+ qzqz+ qyqy = 1 this gives”).
Apparently, one also does not need to renormalize the quaternion when applying any rotations. This is really nice. Applying uniform scaling to any quaternion is then just scalar-multiplying by sqrt(scaleFactor).

Yeap. Since rotation is P’ = QPQ-1 (which eliminates any scale factors) or QPQ* which will scale by magnitude of Q squared and these compose as expected.