public override void Rotate(Vector3 axis, float angle) { Quaternion rot = Orientation; GameComponentHelper.Rotate(axis, angle, ref rot); Orientation = rot; }
/// <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)); }
public override void Rotate(Vector3 axis, float angle) { callCount++; if (callCount == 1 || callCount == 2) { Matrix m = RigidBody.WorldTransform; Quaternion q = Quaternion.CreateFromRotationMatrix(m); Quaternion qc = q; GameComponentHelper.Rotate(axis, angle, ref q); int ibreak = 0; } rotation = Quaternion.CreateFromRotationMatrix(RigidBody.WorldTransform); GameComponentHelper.Rotate(axis, angle, ref rotation); Matrix result = Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(Position); RigidBody.WorldTransform = result; System.Console.WriteLine("RotResult : " + result); // nb scale doesn't really count here as it will be the collisionshape not the rigid body that counts? }
public virtual void Rotate(Vector3 axis, float angle) { GameComponentHelper.Rotate(axis, angle, ref rotation); }