Posted By: enrike
complex animations in model - 12/09/09 07:32
hi
i have this model from Maya with a set of animations with gestures (waving, jumping, dancing...). It also has a basic idle position animation. Each gesture animation has three steps: "start" / "loop" / "end". The model is controlled from gamepad so when the user presses button number 1 the model goes from idle position to animation number 1 doing first the "start" step of the animation, then it enters the "loop" step and it keeps cycling that step until the button is released, at this point it goes to "end" step of the animation and finally goes back to idle position.
So each frame I check which step of the animation I am and do different things depending on the step of the animation I am. I cannot do everything in one while (1){} because it blocks other things happening at the same time.
This is for start and end steps of animation
ent_animate(my, newlabel, animP, ANM_ADD);
animP += speed * time_step; // step
For the loop step of the animation i use
ent_animate(my, newlabel, animP, ANM_CYCLE);
animP += speed * time_step;
animP %= 100;
and this for blending between different steps of animations
ent_animate(my, oldlabel, 100, ANM_SKIP);
ent_blend(newlabel, 0, blendP);
blendP += blend_factor * speed * time_step;
blendP %= 100;
My problems is that because of the way ent_animate works with percentages, all animations must be equal length, otherwise short animations are very fast and long animations very slow. This is very limiting for the animators and for the design of the character so I need to find a way to have different lengths that are played with exactly same speed they are designed in Maya.
My solution was to cycle the animations with
my.frame = nextframe;
where next frame is an index that increases each frame. But I dont like this because I need to store manually in arrays the "keyframes" of each animation step and the code does not look nice.
I hope this explanation is clear enough, i am not sure... Any ideas are welcome. Thanks!
enrike
i have this model from Maya with a set of animations with gestures (waving, jumping, dancing...). It also has a basic idle position animation. Each gesture animation has three steps: "start" / "loop" / "end". The model is controlled from gamepad so when the user presses button number 1 the model goes from idle position to animation number 1 doing first the "start" step of the animation, then it enters the "loop" step and it keeps cycling that step until the button is released, at this point it goes to "end" step of the animation and finally goes back to idle position.
So each frame I check which step of the animation I am and do different things depending on the step of the animation I am. I cannot do everything in one while (1){} because it blocks other things happening at the same time.
This is for start and end steps of animation
ent_animate(my, newlabel, animP, ANM_ADD);
animP += speed * time_step; // step
For the loop step of the animation i use
ent_animate(my, newlabel, animP, ANM_CYCLE);
animP += speed * time_step;
animP %= 100;
and this for blending between different steps of animations
ent_animate(my, oldlabel, 100, ANM_SKIP);
ent_blend(newlabel, 0, blendP);
blendP += blend_factor * speed * time_step;
blendP %= 100;
My problems is that because of the way ent_animate works with percentages, all animations must be equal length, otherwise short animations are very fast and long animations very slow. This is very limiting for the animators and for the design of the character so I need to find a way to have different lengths that are played with exactly same speed they are designed in Maya.
My solution was to cycle the animations with
my.frame = nextframe;
where next frame is an index that increases each frame. But I dont like this because I need to store manually in arrays the "keyframes" of each animation step and the code does not look nice.
I hope this explanation is clear enough, i am not sure... Any ideas are welcome. Thanks!
enrike