Beispiel #1
0
 /// <summary>
 /// Copies a VectorHand from another VectorHand
 /// </summary>
 public VectorHand CopyFrom(VectorHand h)
 {
     if (h != null)
     {
         isLeft = h.isLeft; palmPos = h.palmPos; palmRot = h.palmRot;
         for (int i = 0; i < jointPositions.Length; i++)
         {
             _backingJointPositions[i] = h.jointPositions[i];
         }
     }
     return(this);
 }
Beispiel #2
0
 /// <summary> Fills the ref-argument VectorHand with interpolated data
 /// between the two other VectorHands, by t (unclamped), and return true.
 /// If either a or b is null, the ref-argument VectorHand is also set to
 /// null, and the method returns false.
 /// An exception is thrown if the interpolation arguments a and b don't
 /// have the same chirality.
 /// </summary>
 public static bool FillLerped(ref VectorHand toFill, VectorHand a,
                               VectorHand b, float t)
 {
     if (toFill == null || a == null || b == null)
     {
         toFill = null;
         return(false);
     }
     if (a.isLeft != b.isLeft)
     {
         throw new System.Exception("VectorHands must be interpolated with the " +
                                    "same chirality.");
     }
     toFill.isLeft  = a.isLeft;
     toFill.palmPos = Vector3.LerpUnclamped(a.palmPos, b.palmPos, t);
     toFill.palmRot = Quaternion.SlerpUnclamped(a.palmRot, b.palmRot, t);
     for (int i = 0; i < toFill.jointPositions.Length; i++)
     {
         toFill.jointPositions[i] = Vector3.LerpUnclamped(a.jointPositions[i],
                                                          b.jointPositions[i], t);
     }
     return(true);
 }