Search code examples
c#c++3drotationogre3d

Ogre3D: Rotation relative to custom center point


I'm trying to rotate a node around a custom center point in Ogre3D, but I can't seem to find a way to do this. I've looked into quaternions and matrixes but they don't seem to do what I'm trying to do (but to be honest, I'm not quite sure I completely understand them).

The drawing below illustrates what I want (a 'door' in a wall, as seen from the top). 'o' represents the center point (the hinge), 'x' the door, '=' the wall.

- Original position
- What I get:          What I want:

  == x x o x x ==      == x o x x x ==

- After a 90 degree clockwise rotation:
- What I get:          What I want:

         x
         x                  x  
  ==     o     ==      ==   o       ==
         x                  x
         x                  x
                            x

Solution

  • If this is about an object that you want to rotate around the same point always (like a door), the easiest way would actually be to change the pivot point of the object.

    This can easily be done by your artist in Maya/Max/Blender.

    Or you could attach the door to an extra scene node at the desired position. And then rotate that extra scene node. This has the benefit that you could do everything from Ogre.