Conditions / Branching in Anim Graph?

Hey, I’m wondering:

How should I deal with an animation setup that has a locomotion state machine for the whole body and an “action” state machine to override the upper body’s animation with aiming etc, but only when needed.

I’d also like to be able to add some IK elements on occasion, but I’m not sure how to use flow-control for animation blending. Are state machines even what I need for this?

The only “flow control” I can think of atm is using variables to set blend weights to 0 / 1. But then all the blending methods would still be called unnecessarily, probably wasting a lot of performance.

1 Like

what exactly are you asking? ive done something like this before by making composites out of the rifle aiming animation from the animation starter pack, and changing the speed of it to what i needed. but i only used one state machine for it and it worked quite effectively. as far as conditions go, i keep it simple and have booleans in the players that get activated by input events and corresponding booleans in the animation event graph that use their values, those get used in the conditions to switch states

If I use the blend-by-bool nodes (or int), that’s the only way to “branch”, right?

I just hope, all the unneeded poses/paths are not being computed all the time, so performance doesn’t suffer.

I am asking, because I wondered why there aren’t any flow-control nodes in the anim graph section.
Specifically, I want to be able to activate/deactivate certain blends dynamically. When it comes to aiming, I want to have a state where the animation is 100% locomotion (no aiming) and one where the upper body is using aim-animation and the rest still locomotion.
And on top of that I want to know that aiming poses are not being computed when deactivated, meaning I sincerely hope that if I set a blend weight of 0 or use a blend-by-bool(->false), the entire “animation path/flow” up to that point (0 or false) will not be computed for the frame.

I mean, if I set up a giant anim graph that allows for 20 different types of blending (including IK), I only ever want the currently needed parts to be generated and blended.

Hmm I guess I was being stupid. The state/bool based blending is probably all you need to control flow in animations. I’m just going to assume that no unneeded “animation paths” get computed and there is no performance problem. I’m just writing an answer so I can close the question.

4 Likes

[+1] for blend by bool!
very useful

2 Likes

Blend Poses by Bool works for conditions of true and false. Thank you.

Blend by bool is what I was looking for.

You can cache your pose before you convert it from local to component. Drag out a line and then right click and type “New Saved cached pose”. Then you can click that and rename it to whatever you want. Then when you want to use it, right click and type “Use cached pose” + whatever you named it. Then convert it from local to component. Then you can use the same pose as a base input for both of the true and false inputs, modifying it as you need to to get what you want.

2 Likes