Example #1
0
 private void Awake()
 {
     if (rot != null)
     {
         rot = dice.GetComponent <TransformRotation>();
     }
 }
Example #2
0
 void Start()
 {
     instanciate       = this;
     AuxFinalRotationX = FinalRotationX;
     AuxFinalRotationY = FinalRotationY;
     AuxFinalRotationZ = FinalRotationZ;
     Rotation          = transform.eulerAngles;
 }
Example #3
0
 private void Awake()
 {
     if (rot1 != null)
     {
         rot1 = dice1.GetComponent <TransformRotation>();
     }
     if (rot2 != null)
     {
         rot2 = dice1.GetComponent <TransformRotation>();
     }
     if (rot3 != null)
     {
         rot3 = dice1.GetComponent <TransformRotation>();
     }
 }
Example #4
0
    public TransformRotation GetTransformRotationAtLen(float len)
    {
        int currSplineIdx = -1;

        for (int splineIdx = 0; splineIdx < mNodes.Count; splineIdx++)
        {
            if (mNodes[splineIdx].Len > len)
            {
                continue;
            }
            else
            {
                currSplineIdx = splineIdx;
                break;
            }
        }

        if (currSplineIdx == -1)
        {
            return(null);
        }

        // Calculates the d param between 0 and 1
        float param = (len - mNodes[currSplineIdx].Len) / (mNodes[currSplineIdx + 1].Len - mNodes[currSplineIdx].Len);

        // Smooth the param
        param = MathUtils.Ease(param, mNodes[mCurrentIdx].EaseIO.x, mNodes[mCurrentIdx].EaseIO.y);

        TransformRotation tr = new TransformRotation();

        tr.pos = GetHermiteInternal(mCurrentIdx, param);

        if (mRotations)
        {
            tr.rot = GetSquad(mCurrentIdx, param);
        }

        return(tr);
    }
 public void SetUp()
 {
     containingObject = new GameObject();
     subject          = containingObject.AddComponent <TransformRotation>();
 }
Example #6
0
    public TransformRotation GetTransformRotationAtLen(float len)
    {
        int currSplineIdx = -1;
        for(int splineIdx = 0; splineIdx < mNodes.Count; splineIdx++)
        {
            if(mNodes[splineIdx].Len > len)
            {
                continue;
            }
            else
            {
                currSplineIdx = splineIdx;
                break;
            }
        }

        if(currSplineIdx == -1)
        {
            return null;
        }

        // Calculates the d param between 0 and 1
        float param = (len - mNodes[currSplineIdx].Len) / (mNodes[currSplineIdx + 1].Len - mNodes[currSplineIdx].Len);

        // Smooth the param
        param = MathUtils.Ease(param, mNodes[mCurrentIdx].EaseIO.x, mNodes[mCurrentIdx].EaseIO.y);

        TransformRotation tr = new TransformRotation();

        tr.pos = GetHermiteInternal(mCurrentIdx, param);

        if (mRotations)
        {
            tr.rot = GetSquad(mCurrentIdx, param);
        }

        return tr;
    }