Orientation/Rotation

Thuf

12-12-2007 02:54:48

I'm very new to PythonOgre and I'm having some trouble getting an object setup in an area. I get the object in there fine but its all screwy and out of position from where I want it, also upside down.

c.node.setPosition(ogre.Vector3(30, 5, 30))
This is how I am changing the position of it

c.node.setOrientation(ogre.Quaternion(ogre.Degree(180), ogre.Vector3.UNIT_Y))
I found this example, wouldn't this rotate it around the Y axis by 180 degrees? (it doesn't seem to be doing so for me but maybe my axes are out of wack

Is there a better way at doing this?

bharling

12-12-2007 09:53:53

First of all, are you trying to 'fix' the rotation of your model (say, if you export from blender they usually come out screwy rotation-wise)? If so, then use meshmagick to rotate the actual mesh outside of ogre, it actually modifies the mesh file rather than having to do extra in-game.

Otherwise, I always find it easier to do yaw, pitch and roll with my nodes (as I still dont really understand quaternions properly).


c.node.yaw(ogre.Degree(-90))
c.node.pitch(ogre.Degree(180))


etc..

for moving try:

c.node.translate(ogre.Vector3(10,0,0))


but setPosition should be just as good ( there IS a difference though, I think translate applys a transform to your node, which is different to setting its position directly ).