I have an object that can be rotated and translated. The rotation is represented by a Quaternion and the position a Vector3. The code is loosely based around the code in http://www.opentk.com/node/1292
The following is how the object gets render with the given translation and rotation:
Matrix4 rotate = Matrix4.Rotate(this.Orientation); Matrix4 translate = Matrix4.CreateTranslation(this.Position); Matrix4 m = translate * rotate; GL.PushMatrix(); GL.MultMatrix(ref m); base.Render(); GL.PopMatrix();
My problem is the rotation seems to always rotate around the origin instead of it's position unless I change the multiplication to be:
Matrix4 m = rotate * translate;
But when I do that, it always translates relative to the default rotation of the object.
I noticed if I changed the RageWorld example linked above to be "rotate * translate", both wrong behaviour occurs. Any ideas on what I can do to the rotation Quaternion to correct it's behaviour?