public static void LockRotation(ref Quaternion rotation, Vector3 lockedRots) { lockedRots -= -Vector3.One; Vector3 rots = GameComponentHelper.QuaternionToEulerAngleVector3(rotation) * lockedRots; rotation = Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationX(rots.X) * Matrix.CreateRotationY(rots.Y) * Matrix.CreateRotationX(rots.Z)); }
public void GenerateDefaultName() { guid = Guid.NewGuid().ToString(); Name = GameComponentHelper.GenerateObjectName(this.GetType()); }
public void RotateAA(Vector3 axis, float angle) { GameComponentHelper.RotateAA(axis, angle, ref RotationRef); }
public void TranslateAA(Vector3 distance) { Position += GameComponentHelper.Translate3D(distance); }
/// <summary> /// Method to look at target and lock rotation axis /// </summary> /// <param name="target"></param> /// <param name="speed"></param> /// <param name="fwd"></param> /// <param name="lockedRots">Axis to be lcoked (multiplied by 0)</param> public void LookAtLockRotation(Vector3 target, float speed, Vector3 fwd, Vector3 lockedRots) { GameComponentHelper.LookAtLockRotation(target, speed, Position, ref RotationRef, fwd, lockedRots); }
/// <summary> /// Method to look at a target. /// </summary> /// <param name="target"></param> /// <param name="speed"></param> public void LookAt(Vector3 target, float speed, Vector3 fwd) { GameComponentHelper.LookAt(target, speed, Position, ref RotationRef, fwd); }