How can i play a different animation inside a trigger? I tried using the Begin overlap and the End overlap but for some reason my character won’t return to normal (it keeps on playing the “End overlap animation” that i selected, my blend spaces and state machines don’t work anymore if i use the play animation function)
Set a bool variable to true On Begin Overlap, and to false On End Overlap. Check that bool in the your state machine’s transition conditions. If true, play custom animation, if false, go back to the standard one.
Hello, thank you for your reply!
I setup the state machine but i cannot call the “dead?” boolen that i created.
Create the same bool in the Character BP and change that upon interaction with the trigger, and let the State Machine check that bool continuously and change its internal bool when necessary.
Hello, I tried creating a new bool variable with the same name inside the character BP but it do i connect it with the state machine bool?
The name doesn’t have to be the same though =)
You can check it in the animation event graph. Event Blueprint Update Animation node runs every tick, that’s where you check the character’s bool and set the internal bool.
Same as you check Is Falling. Get Player Character and Cast it to your character class, and then get the Dead bool from that. Set the value to your internal Dead bool. And in the Locomotion set the Dead bool to be the condition for transition to the Dying animation.
Sorry i still don’t understand, could you please show me an example? sorry
I can’t show you any actual screenshots right now since I don’t have access to the Engine at the moment. Luckily, my Paint Skills are impeccable.
There are some differences though: you have to Cast the Player Character to your own Character Class, depending on what it is.
The Dead? variable that you drag out off the Cast node is the variable in the Character BP, and the one to be Set is the Animation BP variable. That’s why I told you the names don’t have to be the same, it might cause confusion.
You can add these functions before or after setting Is In Air and Speed variables, it doesn’t really matter.
Another thing: the Update node fires every tick, and it’s generally a good practive not to do Casting on Tick, since that affects performance. I usually prefer to set a Branch at the beginning of the function chain and save the value from the Cast node to a variable, just to have a reference to the character and that use it instead of Casting.
Thank you so much, it worked!