How to spawn actors with keypress and play In + Idle (indefinetly) + Out animations?

Hi everyone,

I need to spawn multiple actors, one after another, with IN + IDLE (played until key press event) + OUT animations (imported from fbx). The actors should be the boxes or other objects, but not the rigged characters.

So the logic should be like this:
Key pressed event > Spawn Actor1 > Play IN_Actor1 > Continue to IDLE_Actor1 > Loop IDLE_Actor1 indefinitely and wait for another Key press > On Key pressed blend IDLE_Actor1 animation to OUT_Actor1 > wait for OUT_Actor1 to finish > Destroy Actor1 >>>> Key pressed event > Spawn Actor2 > Play IN_Actor2 > Continue to IDLE_Actor2 > Loop IDLE_Actor2 indefinitely and wait for another Key press > On Key pressed blend IDLE_Actor2 animation to OUT_Actor2 > wait for OUT_Actor2 to finish > Destroy Actor2 > Key pressed event >>>>…

I would really appreciate if you could at least point me in the direction of how should I solve this. Is it with State machine? Is it with sequencer? Or just with the Level and Actor Blueprints?

Thank you so much for helping me out on this one.
Dane

Hi DaneBlacic,

this is how I’d do it:

  • I would manually build the blendings through an Animation Montage: Animation Montage | Unreal Engine Documentation. A cool thing about Montages is that you can replay them starting from anywhere within their sequence (you can have “section”, or tell your Play Montage node to start replaying from a specific point in time)
  • each Actor has its blueprint that tells him to play IN on spawn then continue to idle; in each Actor, have also a custom event to trigger OUT (lets call this custom event TRIGGEROUT)
  • in the Level Blueprint, listen for your keypress event to Spawn the Actor. Store a reference to the Actor you’ve spawned again in the Level Blueprint, listen for your keypress event to trigger the TRIGGEROUT custom event in your Actor (that’s why you need to store a reference to it; so you can use it to trigger the event)

The above give you a solid starting point, or so I hope!

Cheers,

f

Hey Fraps77,

Thanks for replying.
The Montage is not available anymore. I’m using the 4.26 version.
Nevertheless, I can do this in Sequencer and easily blend the animation tracks (just overlap them). The question here is - how to make sequencer to play the IDLE track indefinitely?

The rest helps a lot! Thanks once again :slight_smile:

Hey Dani,

I’m referring to “Animation Montages”. Of course they’re still there – for some reason there’s a mistake in the link I posted (just fixed it). Correcting and trying again: Animation Montage | Unreal Engine Documentation

Perfect, I’m on it… I will let you know how it goes.
Thank you so much!

Oh, didn’t mention – you can mark any of your animation montage section as to let it loop indefinitely.
The official documentation is pretty clear on this one!

Cheers
f