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

Linearly interpolates between a source and a target bones pose, and copies the result to the target pose. Can also be used to copy a pose to another one by setting the percent value at 100.

Parameters:

ENTITY* entity pointer
target the target pose number, 1..4
source the source pose number, 1..4
percent the blending percentage, 0..100

Speed:

Medium (percent >= 100)
Slow (percent < 100)

Remarks:

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);
   }
}

See also:

ent_animate, ent_blend, entity.pose

► latest version online