/// <summary> /// Rotates the given Position and Orientation around the Pivot Point, changing the Position and Orientation /// </summary> /// <param name="sRotationMatrix">The Rotation to apply to the object</param> /// <param name="sPivotPoint">The Point to rotate the object around</param> /// <param name="srPosition">The Position of the object (to be modified)</param> /// <param name="srOrientation">The Orientation of the object (to be modified)</param> public static void RotatePositionAndOrientation(Matrix sRotationMatrix, Vector3 sPivotPoint, ref Vector3 srPosition, ref Quaternion srOrientation) { // Rotate the Orientation about it's center to change its Orientation srOrientation = Orientation3D.Rotate(sRotationMatrix, srOrientation); // Rotate the Position around the specified Pivot Point srPosition = PivotPoint3D.RotatePosition(sRotationMatrix, sPivotPoint, srPosition); }
/// <summary> /// Rotates the object around the Pivot Point, changing its Position, without /// changing its Orientation /// </summary> /// <param name="sRotationMatrix">The Rotation to apply to the object, rotating it /// around the Pivot Point</param> public void RotatePosition(Matrix sRotationMatrix) { // If the object should rotate around a point other than it's center if (PivotPoint != mcPositionData.Position) { // Rotate the Position around the Pivot Point mcPositionData.Position = PivotPoint3D.RotatePosition(sRotationMatrix, PivotPoint, mcPositionData.Position); } }