Here is a sample animation player which you can use to break a single animation into segments (e.g. walk, run) so that you don’t have to put those actions in separate animations. You can repeat segments, pause in the middle of a segment or pause between segments.
This works best for animations where the segments are performed in order. But it could be modified to play segments in any order as long as you create smooth transitions between the segments.
The source code is here .
Any suggestions for improvement are appreciated.
For example, it might be better to let the animation run and keep and independent timer to determine when to stop. But using setTime lets me know that the timer is working correctly.
2 Likes
Looks good. I think folks usually end up having to write something like this one way or another for things involving animation… but peoples needs also vary widely so it’s not super standardized.
For instance, for character based animation, sometimes you have to edit the clips to remove the motion from movement animations so that you can control the motion kinematically, or use the motion separately to drive something else.
Another thing you sometimes need is to add “triggers” or events that occur at different points in the animation… (which can be tricky to get right!). You can sometimes achieve this by adding new animation tracks that control a boolean or some other property on the object.
The animation system is actually pretty general/powerful/underused. It can be used for a lot more than just bones.
Having this post here with that searchable title will no doubt help someone dealing with this scenario.
3 Likes
Yes, I plan to add a way to trigger segments. For example, the “take-off” gesture will not be activated until you advance the throttle.
I could also require user input to advance to the next gesture. For example, if the gesture required you to check controls or set brakes, etc., it would not advance until you have done that. However, in this case, I think that would get tedious because your brakes are already set and your flaps are already down and you just want to fly! So I will probably just make it so that the gestures will not start until you are in the cockpit and looking at him (so can see them) and he will run through a quick series of gestures and then wait for you to take off.
1 Like