ent_blend (STRING* scene,
var
anim_percent,
var
blend_percent);
Interpolates the
my
model entities' frame or skeleton between two animation scenes. The source
scene is the current skeleton position or the current
my.frame
parameter, which is set by ent_animate.
Parameters:
| scene |
Target animation scene name, without the trailing number; STRING*
or char* |
| anim_percent |
Percentage within the target scene, 0..100 |
| blend_percent |
Blending percentage between previous and new scene, 0..100 |
Modifies:
| my.frame |
New source frame plus interpolation factor (sprites or
vertex scenes only) |
| my.next_frame |
New target frame (vertex scenes only) |
Speed:
Medium (for vertex frames).
Slow (for bones frames).
Remarks:
- For vertex scenes, the instruction only sets the entity's frame and next_frame
parameters. For bones scenes, the instruction does not alter frame and next_frame,
but blends the entity's skeleton between the scenes.
As entity
animation can only blend between two frames, not between three or
more, ent_blend can
not interpolate between two already-interpolated frames. Therefore
the source and target frames are not interpolated, but set to the
next full frame number.
- Only bones affected
by the given scene are moved. Several bones animations can be blended
by executing this instruction several times for different animation scenes
that can even affect the same sets of bones (see ent_animate example).
- The instruction assumes a cyclic animation scene, which results in
reaching the end position earlier than at 100% in noncyclic scenes.
Edition:
C
P
for bones scenes only. Vertex scenes can be blended with all editions.
Algorithm:
//emulation by C-Script, vertex scenes only
ent_blend (name, anim_percent, blend_percent)
{
var oldframe;
oldframe = my.frame;
if (frc (oldframe) > 0.5) {
if (my.next_frame)
{ oldframe = my.next_frame; }
else
{ oldframe += 1; }
}
ent_cycle (name, anim_percent);
my.next_frame = int (my.frame);
my.frame = int (oldframe) + blend_percent*0.01;
}
Example:
//Sets the entity to a vertex frame within 50% of the walk cycle,
//and then blends over to the first frame of the stand cycle.
ent_cycle("walk",50);
ent_blend("stand",0,25);
//The result of this code is a frame mixed from 75% of the middle
//of the "walk" cycle and 25% of first frame of the "stand" cycle.
See also:
ent_animate