How to set variable in transition logic in anim blueprint?

Hi ,
I am creating transitional animation in motionbuilder from my character , like it changes its state from idle to walking and walking to idle , on pressing and releasing of move forward key(W). So I have two walkstop animation ,when you release W , one from changing back to idle position when the front leg is left(walkstopL) , and one from changing back to idle position when the front leg is right(walkstopR) . I am creating two animations for this , because if you create single walkstop animation , it will be either from left leg to idle or right leg to idle , so in my walk animation , at 0% it starts from right leg , 50% it changes right to left , and 100% of the animation , it is back to its initial position , so when I release W while completing 50% of the animation , it will play walkstopL , else it will play walkstopR. Now , in my transiton state of anim blueprint , I can see that time remaining option appears , and based on that I can say it can enter this transition , but I want this in the walkstop state , not in the transition , so that I can blend between two walkstop animation based on the time remaining , or based on some other bool value , which is being set in the transition graph.

Now , I cant find the option to set a bool value if the time remaining ratio for walk animation is <0.5 , as Set option requires an input action , which can be placed in eventgraph , not in anim graph , so how do I set a bool value inside the walk - walkstop transitional logic. Also , if there are better ways to do this , kindly let me know.

Thanks in advance.

did you ever get this sorted?

I’m not sure of a way to set a value based on the time remaining, but the way I would do it is to set an Animation Notify inside the animation where I want the bool to change:

Next in the Animation Blueprint Event Graph you can now run and event when that Notify goes off:

I’d be interested if someone has a method for checking against the time remaining but for now this is the method I use.

thanks for your advice, I actually had ended up going down that route and I am sure others will find this very useful.

I created an easier way that lets you set a variable essentially whenever the previous state is run.

  1. Create a function in your Animation Blueprint

  2. In that function, set whatever variable you need.

  3. On the return node, return a bool variable.

  4. Set the variable to true and name the output variable “True”

  5. Make the function a pure function

  6. Go into the transition you want to add it to. (or any transition after the state you want it to get run in)

  7. Attach the function to an AND node and attach the input plugged into “Can enter transition” to the other input on the AND node.

  8. Attach the AND node to the “Can Enter Transition”

If you wanted it to only be set once right before it transitions, you could do the following instead:

  1. Create a function in your Animation Blueprint

  2. Add a bool input. I’ll call mine “Transition?”

  3. Add a bool output. I’ll call mine “Out”

  4. Connect the input bool to the output bool.

  5. Add a branch node and connect to both input execute and input bool.

  6. If true, set your variable and then connect execute of set node to return node

  7. If false, just return without setting any variables

  8. Make function pure

  9. Go into the transition you want the variable to be set in when it’s about to transition

  10. Connect what was previously plugged into “Can Enter Transition?” into the input bool node on the function

  11. Connect the output node to the “Can Enter Transition” bool.

I recommend the second method.

For both methods, disable multi threading animations or you get a warning.

1 Like

“If you wanted it to only be set once right before it transitions, you could do the following instead:”

Your solution seems to be good but it’s only working partially for me. Basically, it only works the first time I change the variable’s value (even in test mode inside the animation blueprint - Bool). After that, it stops working. When I look at the transition testing the value of this variable, it seems to be looping as if the variable is constantly being reset and it never goes to the next state. I’ve tested it with a log and the value is either TRUE or FALSE as expected and timed properly with the animation completing and not switching state non-stop - as what it looks like in the anim state. Any idea what might be causing this issue? I thought it could be related to switching OFF the multi-threading, but it doesn’t seem to have any impact. I’ve tested it with 4.27 and UE5 E2.