Animation graph set frame in Animation Clip

Hi,
I was following this tutorial: Animation Graph Overview | NVIDIA On-Demand

May I know how to set the AnimationClip to start at a certain frame upon key pressed? For example to start at 0? Currently when it blends to the next animation it starts playing at the current frame. Thanks.

Hi @qazs!

You may have seen that the Animation Clip node provides a start and end time setting in the Property panel. If these fields are at the default value (0.0), the node will play the entire clip. Otherwise, the time is specified in seconds, and you can specify either start or end, or both. You can even reference the same SkelAnimation multiple times within a graph, using different time ranges!

However, as you also noticed, when two Clip nodes are connected to a Blend node, both nodes will advance their time each frame the graph is processed, regardless of the blend value. This has some benefits but isn’t the behavior you’re looking for.

To get the Clip to start at the specified time, I would suggest leveraging a State Machine node. When you enter a state, the Clip nodes referenced within the state will start at the specified time. There’s an example of this in the Animation Graph Samples window called “state-machine.” If you run this sample, you will see that each time you press A, the walk cycle starts at the beginning, with the right foot. Additionally, the wave animation that plays on S will also start at the beginning each time it’s triggered.

Hopefully this gives you enough information to achieve what you’re looking to do. Have fun!

1 Like

Thanks, managed to achieve the result with state machine

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.