0 registered members (),
1,089
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
ent_blendframe
#407576
09/16/12 03:06
09/16/12 03:06
|
Joined: Sep 2009
Posts: 84
Theil
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2009
Posts: 84
|
Hi I have a problem with this function I can't wrap my head around it I don't seem to understand how to use it can somebody please help me understand this function? Here is a simple script for walking
if(key_w == ON || key_d == ON || key_s == ON || key_a == ON){
if(key_w == ON && key_s == ON || key_a == ON && key_d == ON){
ent_animate(me,"stand",my.skill1,ANM_CYCLE);
my.skill1+=5*time_step;
my.skill1 %= 100;
my.skill2 = 0;
}else{
ent_animate(me,"walk",my.skill2,ANM_CYCLE);
if(my.skill2 <= 100){
ent_blendframe(me,NULL,"walk",6,my.skill2);
}
my.skill2+=1*time_step;
}
} else{
ent_animate(me,"stand",my.skill1,ANM_CYCLE);
my.skill1+=5*time_step;
my.skill1 %= 100; my.skill2 = 0;
}
it runs within a while loop but I can't get ent_blendframe to work properly. any suggestion? thanks a lot for reading.
Last edited by Theil; 09/16/12 15:42.
|
|
|
Re: ent_blendframe
[Re: Superku]
#407759
09/19/12 02:15
09/19/12 02:15
|
Joined: Sep 2009
Posts: 84
Theil
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2009
Posts: 84
|
I've been experimenting with it trying to blend one animation to the next one but I get this kind of snapping, as if it's skipping animation frames. as my exmaple above I have ent_blendframe(me,NULL,"walk",6,my.skill2); so help me understand what should go in the fourth parameter? I tried 0 and even the my.skill1 and 2 with no smooth blending results. according to the documentation the fourth parameter is: anim_percent Percentage within the target scene, 0..100 but what does this exactly means? thanks for answering superku
|
|
|
Re: ent_blendframe
[Re: Theil]
#407760
09/19/12 02:31
09/19/12 02:31
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Blending doesn't work too well with vertex animations, you can only blend between two full (integer) frames. Imagine the following scenario: "walk" consists of 10 frames, my.skill2 is 37. After the instruction ent_animate(me,"walk",my.skill2,0); your model's mesh will be blended by 70% from walk frame 3 to frame 4.
When you now call ent_blendframe(me,NULL,"stand",6,75); you try to blend the walk frame 3.7 and the stand frame 0.6 but as you can only blend between integers resp. the "entity.frame" and "entity.next_frame" parameters, the result will be a blend of walk frame 4 (or 3, I don't know if the function searches the closest or the next-lower integer) and stand frame 1 (or 0). Thus there will be some kind of snapping.
It's very hard to explain, especially in English, just keep in mind that ent_animate and ent_blendframe (probably) only set the frame and next_frame parameters, the resulting mesh is calculated afterwards before rendering.
EDIT: What you can try is to let an animation reach a full integer frame and then blend to another integer frame of the stand cycle.
Last edited by Superku; 09/19/12 02:33.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
|