예제 #1
0
 /// <summary>
 /// Initializes the circular movement.
 /// </summary>
 /// <param name="rigidbody">The rigidbody to be moved.</param>
 /// <param name="args">the arguments that define the movement.</param>
 public QGradualCircularMovement(Rigidbody rigidbody, CircularMovementArgs args)
 {
     this.rigidbody      = rigidbody;
     isRigidBodyMovement = true;
     initial             = args.startingPosition;
     final                 = args.finalPosition;
     pivot                 = args.referencePivot;
     movementTime          = args.time;
     this.degree           = args.degree;
     movementStacked       = args.stacked;
     this.attemptMerge     = args.attemptMerge;
     this.onMovementFinish = args.onMovementFinish;
     if (degree < 10 || degree > 180)
     {
         throw new Exception("The degree input into a gradual circular movement must be between 10 and 180.");
     }
     else if (args.degree == 180)
     {
         degree = 179.99f;
     }
     if (QVectorCalculations.Vector3MathfApproximately(initial, final))
     {
         throw new Exception("The input starting and ending vectors cannot be the same!");
     }
     if (QVectorCalculations.Vector3Colinear(initial, initial, pivot))
     {
         throw new Exception("The reference pivot, starting position, and the final position cannot be colinear!");
     }
     this.degree       = degree * Mathf.Deg2Rad;
     this.isWorldSpace = args.isWorldSpace;
     movedObject       = rigidbody.gameObject;
     this.onFramePass  = args.onFramePass;
 }
예제 #2
0
 /// <summary>
 /// Initializes the circular movement.
 /// </summary>
 /// <param name="gameObject">The gameobject to be moved.</param>
 /// <param name="args">the arguments that define the movement.</param>
 public QGradualFullCircularMovement(GameObject gameObject, CircularMovementArgs args)
 {
     movedObject           = gameObject;
     initial               = args.startingPosition;
     final                 = args.finalPosition;
     pivot                 = args.referencePivot;
     movementTime          = args.time;
     movementStacked       = args.stacked;
     this.attemptMerge     = args.attemptMerge;
     this.onMovementFinish = args.onMovementFinish;
     if (QVectorCalculations.Vector3MathfApproximately(initial, final))
     {
         throw new Exception("The input starting and ending vectors cannot be the same!");
     }
     if (QVectorCalculations.Vector3Colinear(initial, initial, pivot))
     {
         throw new Exception("The reference pivot, starting position, and the final position cannot be colinear!");
     }
     this.isWorldSpace = args.isWorldSpace;
     this.onFramePass  = args.onFramePass;
 }