x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can i play a different animation inside a trigger?

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)

Product Version: UE 4.21
Tags:
more ▼

asked Jan 10 '19 at 02:26 PM in Blueprint Scripting

avatar image

HedgehogSonic
8 1 2

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Jan 10 '19 at 02:46 PM

avatar image

Tuerer
1.2k 6 6 8

avatar image HedgehogSonic 6 days ago

Hello, thank you for your reply! I setup the state machine but i cannot call the "dead?" boolen that i created.

avatar image Tuerer 6 days ago

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.

avatar image HedgehogSonic 6 days ago

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?

avatar image Tuerer 6 days ago

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.

avatar image HedgehogSonic 6 days ago

Sorry i don't understand. Here is a screenshot of my animation BP event graph alt text

untitled.png (323.7 kB)
avatar image Tuerer 6 days ago

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.

avatar image HedgehogSonic 6 days ago

Sorry i still don't understand, could you please show me an example? sorry

avatar image Tuerer 6 days ago

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.alt text

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.

dead.png (9.1 kB)
avatar image HedgehogSonic 6 days ago

Thank you so much, it worked!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question