#### Archived

This topic is now archived and is closed to further replies.

# transformations...

This topic is 5277 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hiya Im a bit confused about quaternions and matracies. Im working on a game right now and im trying to figure out the best way to do transformations. In the past, I simply used two 3d vectors, one for translation and one for rotation (im using OpenGL btw). I need to add a camera class and I want to create a "movement" class to make handeling physics and well characer movement easier, but im not sure rather I should use quaternion based rotation, a matrix, or plain old vectors. (btw, I have made a complete class for all three.) The only reason I can see using matracies is better then standard 3d vectors is that it makes it easier when adding children and calculating there offset positions. The game will be an overhead rpg, no 6 dof. So I really think quaternions would be overkill since there used to avoid gimble lock. I don''t know what Im trying to ask here, I guess what should I do in which situation like with children entities and such... Thanks a ton for any comments/advice. Oh, the movement class, If I wanted to use this to handle physics, what may I want to add to it (say if I want to add car physics and such)? Thanks again. Lost and Confused...damned blonde hair! lol ~Jason

##### Share on other sites
Im not sure if I quite understand the question but here goes anyway. For a camera I would definately use quaternions because not only do they avoid gimbol lock (as you say) but interpolating between two view points and angles using quaternions leads to a much smoother and more natural motion. To represent the orientation of game objects you need to way up several factors. Quarternions take up less space (4 paramaters compared to a matricies 9) and are less computationaly expensive. However matricies have the advantage that they can be concatenated which is extremely useful and saves much computation if you have object hierarchies. Hence if your''re using parent objects with many children I''d use matricies for them. Also matricies are easier on the brain Hope this helps

##### Share on other sites
Cool, Thanks a lot. Im going to write a quaternion based camera class and use matracies for my objects since I am using a hierarchy system for the objects (parents and children). About matracies, I have a 4x4 matracie class, would you recommend using a 3x3 instead?

##### Share on other sites
quote:
Original post by no one
About matracies, I have a 4x4 matracie class, would you recommend using a 3x3 instead?

It depends on whether you want to include a translation transformation in your matrices. But if you are only going to use your matrices for rotation and/or scaling, then using 3x3 matrices would save some memory.

##### Share on other sites
Why is good using 4x4 matrices. Isn''t it cheaper to use 3x3 matrices, and use a translation vector. There are a lot of unnecessary zero element in the 4x4 matrix. Or is there a fast multiplication algorithm for it? 3x3 mult. = 9 mult, 4x4 mult. = 16 mult., it''s almost twice more.
So when you want to transform with this matrix during displaying, you just create a 4x4 matrix from the the 3x3 matrix and translation vector and use that. In OpenGL it is simple, although I haven''t used it yet.

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 19
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633362
• Total Posts
3011531
• ### Who's Online (See full list)

There are no registered users currently online

×