コード例 #1
0
 /**
  * This is designed as a test to see if the finaliseTranslations function can
  * be merged into the apply translation function so that when the work alignment
  * changes then the previous tranlation and effector count are applied.
  * This should allow the removal of the looping through all the vertices at the
  * end of a cycle.
  */
 public void applyTranslationV2(float xmov, float ymov, float zmov, RFrame_Sim affirmer)
 {
     // Check if the work alignment matches.
     if (workAlignment != affirmer.getWorkAlignment())
     {
         // The finalise translations is placed here before
         // resetting.
         if (effectorCount > 0)
         {
             x += (xWork / effectorCount);
             y += (yWork / effectorCount);
             z += (zWork / effectorCount);
             Transform tr = GetComponent <Transform>();
             tr.localPosition = new Vector3(x, y, z);
         }
         workAlignment = affirmer.getWorkAlignment();
         xWork         = xmov;
         yWork         = ymov;
         zWork         = zmov;
         effectorCount = 1;
     }
     else
     {
         xWork += xmov;
         yWork += ymov;
         zWork += zmov;
         effectorCount++;
     }
 }
コード例 #2
0
 /**
  * All translations are applied to vertices that have a effectorCount
  * of greater than zero. If they don't then their work alignment is
  * boolean waltzed.
  * @param affirmer
  */
 public void finaliseTranslations(RFrame_Sim affirmer)
 {
     if (effectorCount > 0)
     {
         x += (xWork / effectorCount);
         y += (yWork / effectorCount);
         z += (zWork / effectorCount);
         Transform tr = GetComponent <Transform>();
         tr.localPosition = new Vector3(x, y, z);
     }
     else
     {
         // This is done so that this vertex doesn't get out of step
         // with the other vertices. Especially since I'm using a
         // boolean waltz. :)
         workAlignment = affirmer.getWorkAlignment();
     }
 }
コード例 #3
0
 /**
  * When the work alignment switch of this vertex does not match the
  * work alignment of the current cycle, the work variables are reset
  * by applying the mov variables directly and then setting this
  * vertex's work alignment to match.
  * @param xmov Translation on the x-axis
  * @param ymov Translation on the y-axis
  * @param zmov Translation on the z-axis
  * @param affirmer This allows work alignment switching synchronisation
  */
 public void applyTranslation(float xmov, float ymov, float zmov, RFrame_Sim affirmer)
 {
     if (workAlignment != affirmer.getWorkAlignment())
     {
         workAlignment = affirmer.getWorkAlignment();
         xWork         = xmov;
         yWork         = ymov;
         zWork         = zmov;
         effectorCount = 1;
     }
     else
     {
         xWork += xmov;
         yWork += ymov;
         zWork += zmov;
         effectorCount++;
     }
 }