Beispiel #1
0
 private void Update()
 {
     if (morphStates.Length == 0)
     {
         return;
     }
     for (int i = 0; i < computer.pointCount; i++)
     {
         Vector3 pos    = morphStates[0].points[i].position;
         Vector3 tan    = morphStates[0].points[i].tangent;
         Vector3 tan2   = morphStates[0].points[i].tangent2;
         Vector3 normal = morphStates[0].points[i].normal;
         Color   col    = morphStates[0].points[i].color;
         float   size   = morphStates[0].points[i].size;
         for (int n = 1; n < morphStates.Length; n++)
         {
             pos    += (morphStates[n].points[i].position - morphStates[0].points[i].position) * morphStates[n].percent;
             tan    += (morphStates[n].points[i].tangent - morphStates[0].points[i].tangent) * morphStates[n].percent;
             tan2   += (morphStates[n].points[i].tangent2 - morphStates[0].points[i].tangent2) * morphStates[n].percent;
             normal += (morphStates[n].points[i].normal - morphStates[0].points[i].normal) * morphStates[n].percent;
             col    += (morphStates[n].points[i].color - morphStates[0].points[i].color) * morphStates[n].percent;
             size   += (morphStates[n].points[i].size - morphStates[0].points[i].size) * morphStates[n].percent;
         }
         SplinePoint point = computer.GetPoint(i, Space.Local);
         point.type     = SplinePoint.Type.Broken;
         point.position = pos;
         point.tangent  = tan;
         point.tangent2 = tan2;
         point.normal   = normal;
         point.color    = col;
         point.size     = size;
         computer.SetPoint(i, point, Space.Local);
     }
 }