#### Archived

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

# glMultiMatrix - Rotation/Translation alternative?

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

## Recommended Posts

Hi. I''m currently in the process of porting my insect based crowd simulation from a standard OpenGL drawing function which I wrote to the Ogre Graphical Engine (www.ogre3d.org). Now in the current implementation, I simply give OpenGL a matrix which looks like this :
 forward.x forward.y forward.z    0
side.x     side.y     side.z  0
up.x       up.y       up.z  0
position.x position.y position.z  1


(or whatever) So each insect ''agent'' updates its forward, side, up and position each frame using Euler Ingeration. Now Ogre (AFAIK) doesn''t have an equivilent function I can pass the orientation matrix to...so I need to do it manually... Can anyone tell me / put me on the right track as to how I would do this? I imagine it can be done with rotations/translations... Cheers, SFA.

##### Share on other sites
i think you are doing you matrix math wrong..
you have do each transformation on an Identity matrix then
multipy to get your final transform mat.

this is from memory so,

Translation Matrix:
    |  1    0    0    x  |          A = |  0    1    0    y  |     |  0    0    1    z  |     |  0    0    0    1  |

Rotation Matrix (Rotation about Y of angle ''Q''):
    |  cos Q   0    sin Q   0 |            B = |    0     1     0      0 |                |  -sin Q  0    cos Q   0 |                |    0      0    0      1 |

your final matrix you pass to Ogre will just be
[ A times B ]

hope that helps.

1. 1
2. 2
Rutin
22
3. 3
JoeJ
18
4. 4
5. 5

• 17
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631726
• Total Posts
3001910
×