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));
        }
示例#2
0
 public void GenerateDefaultName()
 {
     guid = Guid.NewGuid().ToString();
     Name = GameComponentHelper.GenerateObjectName(this.GetType());
 }
示例#3
0
 public void RotateAA(Vector3 axis, float angle)
 {
     GameComponentHelper.RotateAA(axis, angle, ref RotationRef);
 }
示例#4
0
 public void TranslateAA(Vector3 distance)
 {
     Position += GameComponentHelper.Translate3D(distance);
 }
示例#5
0
 /// <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);
 }
示例#6
0
 /// <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);
 }