/// <summary> /// Method to revolve and object /// </summary> /// <param name="target"></param> /// <param name="axis"></param> /// <param name="angle"></param> /// <param name="position"></param> /// <param name="rotation"></param> public static void Revolve(Vector3 target, Vector3 axis, float angle, ref Vector3 position, ref Quaternion rotation) { GameComponentHelper.Rotate(axis, angle, ref rotation); Vector3 revolveAxis = Vector3.Transform(axis, Matrix.CreateFromQuaternion(rotation)); Quaternion rotate = Quaternion.CreateFromAxisAngle(revolveAxis, angle); position = Vector3.Transform(target - position, Matrix.CreateFromQuaternion(rotate)); }
/// <summary> /// Method to rotate object /// </summary> /// <param name="axis"></param> /// <param name="angle"></param> public virtual void Rotate(Vector3 axis, float angle) { GameComponentHelper.Rotate(axis, angle, ref rotation); }