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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to effectively play an animation on click?

K im making a character that will play a swing animation on left click, i set a bool to true that is used in the animblueprint to start the transition to the swing anim, once the ratio of the anims completion is less than 0.2 i transition back to the idle anim. once completely i set the bool to false so that it wont cycle back into the attack anim.... this works.

but... ive noticed a delay, i small window of time where the swing animation is finishing up (probably within that 0.2 ratio) so obviously the bool is false at this time, so if i click at this particular time it sets it to true and it does the other functionality of the swing attack but doesnt play the animation because the previous animation is not finished yet.

when setting the ratio completed check to 0.05 it stays in the attack state indefinetly, if i trigger the setting of the bool off of the "END" of the transition it stays at the last frame of the anim and never goes to the idle state.

has anyone made a fool proof click triggered animation? am i doing this just horribly wrong or what?

Product Version: Not Selected
more ▼

asked Apr 23 '14 at 06:23 AM in Blueprint Scripting

avatar image

347 29 147 200

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You may want to try using an AnimMontage for your swing animation. It will allow you to take all of that logic out of your state machine and basically just play your swing animation over whatever else is happening. There's a pretty thorough tutorial for setting up an attack using montages in the documentation here: LINK. Note, in that example, they are setting up the animation to only play on the character's upper body, but you can just as easily play the montage on the character's entire body by not filtering the output of the Slot node with a LayeredBlendPerBone.

Good luck, and just yell if you have any other questions/issues.

more ▼

answered Apr 23 '14 at 02:25 PM

avatar image

Ray Arnett STAFF
1.4k 45 17 71

avatar image ClaverFlav Apr 24 '14 at 11:43 AM

holy crap two awesome answers in a row, thanks man.

just barely saw the new mention of animmontage on the front page, zeitgeist!

thanks again man. :)

avatar image Snurrebassen Apr 28 '14 at 10:45 AM

Sorry if I am bumping up a resolved problem. I am trying to follow along that tutorial you posted Ray, but I am having problems with the section "Setting Up the Event Graph". I don't really understand the part with the blueprint interface, and how it would look/work. Any chance of getting some help here? thx

avatar image Ray Arnett STAFF Apr 28 '14 at 02:02 PM

Sure, I think I can clarify that a bit.

First, you'll need to create a Blueprint Interface (Rt-click in the content browser, go down to Miscellaneous and it should be at the top). Then add a function to your Blueprint Interface. You'll use this to trigger the event in your AnimBP EventGraph (I think they called it 'startAttack' or something in the Montage example). That's it for the Interface!

Next, you'll need to implement the BP Interface in your Character BP. Do that by clicking on Blueprint Props up in the toolbar, Then, in the properties panel that pops up, under Interfaces, add the Interface you just created. You'll then use that interface and function to send a message to your AnimationBP by getting the Mesh (Get Mesh), getting the mesh's Anim Instance (which will give you its AnimBP in this case), and then sending a message using the function in your Interface. Like so:

alt text

Finally, you'll need to implement that Interface in your AnimBP just like we did for the Character BP. After that, you should be able to use the function from your Interface as an Event to trigger whatever you want to do. Like this:

alt text

Note, in my example, the name of the function in my BP Interface was 'DoSomething'.

Hope that makes things a little clearer!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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