ent_blendpose( ENTITY*, var target, var source, var percent)

Diese Anweisung erzeugt eine lineare Interpolation zwischen der Source und der Target Bones Pose und kopiert das Ergebnis in die Target Pose. Kann auch verwendet werden, um eine Pose in eine andere zu kopieren, indem der Prozentwert auf 100 gesetzt wird.

Parameter:

ENTITY* Entity-Pointer
target Die Ziel-Pose, 1..4
source Die Quell-Pose, 1..4
percent Prozent der Überblendung, 0..100

Geschwindigkeit:

Mittel (percent >= 100)
Langsam (percent < 100)

Bemerkungen:

Example (lite-C):

// let a model run, and smoothly blend over to shooting when [Ctrl] is pressed
action bones_test()
{
   while(1)
   {
      my.skill1 += 3*time_step; // running torso animation
      my.skill2 += 3*time_step; // running legs animation
      if (key_ctrl) // fire key pressed?
      {
         my.skill3 += 20*time_step; // shoot blending percentage
         my.skill3 = minv(my.skill3,100); // limit at 100 percent
      }
      else
      {
         my.skill3 -= 20*time_step;
         my.skill3 = maxv(my.skill3,0); // limit at 0 percent
      }
      
      // reset skeletion and then compose the animation (order is important):
      ent_animate(me,NULL,0,0); // reset all poses

#ifdef USE_POSES 
      // compose the poses: 1 = running, 2 = shooting
      // animate the running legs in pose 1 and pose 2
         my.pose = 1;
         ent_animate(me,"run_legs",my.skill2,ANM_CYCLE);
         // copy the running legs from pose 1 to pose 2 - faster than animating separately
         ent_blendpose(my,2,1,100);
         // animate the torso in pose 1 only
         ent_animate(me,"run_torso",my.skill1,ANM_CYCLE+ANM_ADD);
         // if [Ctrl] pressed, animate the shooting torso in pose 2 only
         if (my.skill3 > 0)
         {
            my.pose = 2;
            ent_animate(me,"shoot",0,ANM_ADD); // we assume only one shooting frame
            // now blend shooting (pose 2) into running (pose 1)
            ent_blendpose(my,1,2,my.skill3);
         }
#else
         // alternatively, same animation without poses - order is important
         // first, move the torso during running
         ent_animate(me,"run_torso",my.skill1,ANM_CYCLE);
         // then blend over to, or blend back from shooting (only affects the torso)
         if (my.skill3 > 0) ent_blend("shoot",0,my.skill3); 
         // finally animate the legs
         ent_animate(me,"run_legs",my.skill2,ANM_CYCLE+ANM_ADD);
#endif

      wait(1);
   }
}

Siehe auch:

ent_animate, ent_blend, entity.pose

► Aktuelle Version Online