# How Matrix3 works

IvanJ147

13-09-2013 10:59:49

Hi everyone,
I have big problems to understand how Ogre/Mogre manages Matrix3 objects.
I try to explain: with Maya 2011 I've created a simple object, you can see it here:

As you can see the coordinate system of Maya is the same as Ogre (http://www.ogre3d.org/tikiwiki/Basic+Tutorial+1)
I tried to export this file in .X, and I've written a software in VB.NET that by DirectX allows to change the rotation matrix of the object and to view it.
Remember that DirectX has a different coordinate system (http://msdn.microsoft.com/en-us/library/windows/desktop/bb204853(v=vs.85).aspx).
With my software I made some tests, in order to understand matrix behavior, and I think I undestood how they work.
For example, if I want to make the object "look at right", I know that its X local axis has to look at -Z global axis (so the first row of my matrix is 0 0 -1), Y axis rimains the same (so the second row of my matrix is 0 1 0) and its Z local axis has to look at X global axis (so the third row of my matrix is 1 0 0).
I've tried it with my software, and everything works.

If I try other tests everything always work, so I think that my reasoning is correct.
I've written another software to simulate the same thing with VB.NET and Mogre.
Considering that Ogre Z axis is opposite respect to DX Z axis, the matrix should became (0 0 1, 0 1 0, -1 0 0), right?
In this video you can see it better:
http://youtu.be/ijzxtonj_Ek
On the contrary on my software I see the object rotated to another direction.

Can anybody explain me why does my reasoning work only with DirectX and not Ogre? I can't understand..

Beauty

26-10-2013 13:04:50

Hi,

I'm very sorry that I'm here only seldom, because I have much to do on my working place and very less free time.

Related to Matrix3. For this class Mogre has no wrapper. Instead the code was ported to C#, because it's faster.
So you can have a look to the code to see how it's implemented.

See it online here:
https://bitbucket.org/mogre/mogre/src/4 ... atrix3.cpp

If you want to look to it in an editor, just run the MogreBuilder (wiki page, BitBucket repository).
`<MogreBuilderTargetDirectory> / Main / src / Custom / MogreMatrix3.cpp`