Rotating around fixed axis
-
Hi, I want to rotate a mesh around a FIXED axis that does not rotate like the axis of the mesh itself. thats my code so far:
device.Transform.World = Matrix.RotationYawPitchRoll(yaw, pitch, roll) * Matrix.Translation(x, y, z);
But whith that code the mesh rotates around the axis of itself. -
Hi, I want to rotate a mesh around a FIXED axis that does not rotate like the axis of the mesh itself. thats my code so far:
device.Transform.World = Matrix.RotationYawPitchRoll(yaw, pitch, roll) * Matrix.Translation(x, y, z);
But whith that code the mesh rotates around the axis of itself.Try swapping the rotation Matrix and the translation matrix like this.
device.Transform.World = Matrix.Translation(x, y, z) * Matrix.RotationYawPitchRoll(yaw, pitch, roll);
-
Try swapping the rotation Matrix and the translation matrix like this.
device.Transform.World = Matrix.Translation(x, y, z) * Matrix.RotationYawPitchRoll(yaw, pitch, roll);
-
Hi, I want to rotate a mesh around a FIXED axis that does not rotate like the axis of the mesh itself. thats my code so far:
device.Transform.World = Matrix.RotationYawPitchRoll(yaw, pitch, roll) * Matrix.Translation(x, y, z);
But whith that code the mesh rotates around the axis of itself.This might be a little vague, but better than nothing I hope. One way to rotate about an arbitrary axis (there are others): - find the unique point on the axis such that a line from that point to the origin is perpendicular to the axis - let's suppose the point is 1,2,3 -translate that point to the origin - Translation(-1,-2,-3) -do the rotation -undo the translation - Translation(1,2,3) Hope that helps a bit