Download

Base Idle Animation, Random Idle Animation (from a vast range), Base Idle Animation, LOOP

UE4.24.3: How do we play a “base” idle animation, and at the end of it, play a *random *animation (selected from a vast range of animations), and at the end of it, replay the “base” idle animation, and at the end of it, play a random animation, possibly different from the previous one?

The idea is that a base idle animation (0) is played **between **each random idle animation (from 1 to infinite).

In other words: 0 ,“base” idle animation, is played; at the end of it, 2 is randomly selected and played; at the end of it, 0 is played again; at the end of it, 5 is randomly selected and played; at the end of it, 0 is played again; at the end of it, 8 is randomly selected and played; 0 would be played *between *each random idle animation.

Can you help me set this up, please? :slight_smile:


You can create a state with a blend and put inside a blend poses by int
using anim event you can know when change values

Thank you for you answer! :), those who are new like me will have some problems understanding this. So help me make some clarity:

To accomplish this *Base Animation, Random Animation, Base Animation *Loop, I have to make an Animation Blueprint with a State Machine with two states; let’s call them: Base Idle, and Random Idle. In Base Idle I can put the Base Idle Animation, that will be played first.

In the other *state *(Random Idle), I have to add a Blend Poses by Int, with all the Random Idle Animations that will be played after the Base Idle Animation.

Is it **right **until here?

I also have other questions, I hope you can answer them, DomusLudus.

By “blend” do you mean Blend Space?

Test--Unreal-Editor-4_21_2020-10_39_49-PM.png

By “anim event” do you mean the Event Blueprint Update Animation, in the Event Graph?

Test--Unreal-Editor-4_21_2020-10_44_06-PM.png

I’m sorry, but by “change values” I don’t know what you mean. Can you please explain me? :slight_smile:

I would suggest using montages instead so you can selectively animate only the top to be different.

And btw, you dont have to use montages, you can create a new state machine, cache the pose, and apply it on a blend per bone basis.

You can do what you are trying to do in a thousand ways, and not a single one is necessarily better then the other.

However
if you add an extra idle state to the state machine, you then need to create all the same links to the different states for it.
Therfore, you are better off using a nested state machine - create a state machine inside the idle state machine and make any changes/selections there.
That way whatever the settings for the original transitions into walking/jumping etc. Won’t change.

I think it would be great to know all the ways this could be done… :slight_smile:

Thanks, I didn’t know we could do that!

I’m sorry (also for all of those who are new that will search this question) that there is not a complete answer, yet!

Can you tell we the simplest way to do this, please? :slight_smile:

btw I usually make montages for breaks, every x time I shoot one, it is more organic than waiting for the main idle to finish.

Yes

No, blend poses by int I mean.

You can create events in transitions, that are activated in the graph, you can use this events for change the next randon int

Thank you, very clear answer, I appreciate that. Now I can continue:

So, I have the two states of the State Machine: Base Idle, and Random Idle. Now I have to say to Unreal Engine that I want to go (at the end of the Base Idle Animation) from Base Idle to Random Idle, which I can do in two ways:
1. With a Notify Event (added by:
opening the Animation from the “Content Browser” with double-click, and then right-clicking on the “Notifies” bar, “Add Notify…”, “New Notify…”,
set-up a name for the Notify and drag it to the end of the “Notifies” bar);

2. With an “Animation Montage”, which I don’t know how to use.

You say an Animation Montage is more *organic *than a Notify, right? Can you link, or tell how to use the Animation Montage to make Unreal Engine recognize the end of an Animation, please?
I think me and others would greatly appreciate your effort!

Great! I didn’t know that we could use the Event Graph to create an event that represents the Start of the Transition from one* (Machine) State* to other, or the End of the Transition, or the Interruption of the Transition…
How does it work? Let’s say, the Start of the Transition, what does it mean? When I create that Event in the Event Graph, am I saying to Unreal Engine that** it has to do something at the beginning of the transition**? Or am I saying to Unreal Engine that** in a condition the transition can begin**?

Please, I’m still stuck. Send some help

No idea what you are stuck on.

Easiest way.
inside locomotion add another state machine.
create a boolean called alternate idle.
Create an integer called idleID

Inside the new state machine add a state called “start” put a 1 frame copy of the end pose of idle. It’s literally only used as “backup”.

From this state machine create many others. To transition into it make use of the idleID int AND the boolean (2 is better then 1 for error prevention).

inside those states, you plug in the idle animation and disable loop. Possibly disable blend time or set to .01
Then you create a return pathway with “automatic” which should simply go back once the animation is done.

Make sure you also have a 2 way on the start state machine to entry.

Technically that’s all.
You then need to figure out the best way to pick a random in range.

You so this using the notify so its selected at the end of the idle before the transition happens.
I would keep the notify 2 frames before the end.

in normal conditions the notify will cause the transition to happen just before the last frame, which is why that’s used in start. And the transition from start to the new idle is probably less than frame, so you potentially do skip the end frame.

The worse case scenario possible is that the frames go out of sync and the automated blend time system picks up the slack masking any errors in the transitions.

Hello! Thanks for your answer! :slight_smile:

By locomotion do you mean the AnimGraph (of my Animation Blueprint)? Or by locomotion you mean the Graph Node (which is inside the State Machine inside the AnimGraph)?

These are what I call Graph Node(s). Maybe the most precise term is State, since you called it like that here:

and since under Graph Node there is written Animation State… and since when you drag an arrow from “Entry” (inside the State Machine) it requests if you want to add a new State or a new Conduit…

Test--Unreal-Editor-4_26_2020-6_01_26-PM.png

or the best term to call a Graph Node is Locomotion? I don’t know, will you also tell (a part of telling what you mean by locomotion, in case is something different) what’s the most precise version of calling a Graph Node, please? :slight_smile:

A. State
B. Animation State
C. Graph Node
D. Locomotion

Edit:

Hei! I was looking for a video, found searching for How to Trim Animations in Unreal Engine (to put a 1 frame copy of the end pose of idle), and I found this:

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_189899_1587919052558_738”,“title”:“1-20–Using-Slot-Nodes-and-Branch-Points-in-UE4–YouTube-and-5-more-pages–Personal–Microsoft\u200b-Edge-4_26_2020-6_36_15-PM_LI.jpg”}[/ATTACH]

So maybe by locomotion you mean State Machine? ~ He, Zak Parrish, who made that video, posted under the name of Unreal Engine (in the official channel!), so as you, he should know better than me (and new Users) terms and definitions. Please, confirm that you mean State Machine, when saying Locomotion!

And please, answer quick… 0 : (

Yes.
You may want to watch this whole series several times:

I am very frustrated… Why is there not an answer saying in a ***New User Friendly way ***how to to make an Idle made of 1 Base Idle and 8 Random Idles, where at the end of the 1 Base Idle, one of the 8 Random Idles plays, and at the end of one of the 8 Random Idles the 1 Base Idle plays again, and any movement (any speed) would interrupt the Idle animations?.. How do I do that, in a clear and simplified way that does not give any doubts about the steps (using difficult language, slang for technical words, and uses instead the most precise and intuitive names) to a new user, and spares hours of research trying to understand how to complete a step vaguely explained in an “answer”? I feel like any new user joining this Topic would not find a quick solution to this problem, and would have to spend precious time reading all these messages that didn’t clarify in a New User Friendly way how to make a Base Idle, Random Idle, Base Idle again Loop. Please, somebody send help soon! :frowning:

Create an Anim Sequence variable array, add an event when entering base idle state to get random int in range (from 0 to total amount of random idles), get animation from array using the random int, assign that animation to a variable, add an animation node in your random idle state and expose the sequence pin and input your animation variable, tick Automatic Rule Based on etc. on the transition to both idles.

How to do this for New Users?

Go into your Animation Blueprint, go into AnimGraph, go into your New State Machine (you can call it Locomotion) and enter the State where you want to put the 1 frame copy (to follow these answers there should be another State Machine in the State, with another State called Start). Inside this last State(Start) you can add the animation(searching it by name with Right-Click or dragging it through your Asset Browser). When you have your Play “Animation Name” in the black space with white squares (you can connect it to Output Animation Pose), Right-Click itand at the bottom there is an option called “Convert to Single Frame Animation” (under Sequence Player). Click on it, and the Play “Animation Name” is gonna change to Evaluate “Animation Name”.
In Explicit Time you can add a Float Number, which represents the number of the frame we want to “freeze” the animation on.

To know what’s the last frame of your animation, open your animation (easily doable by double-clicking on the animation called* Evaluate “Animation Name”*) and look at the bottom of the page, the last frame is written at the bottom-right corner, above the Play button, after the name Current Frame (example: Current Frame num.1 / num.2 Frame, where num.2 is the last frame of that Animation).
You can insert that num(2) into the Explicit Time of your Evaluate (Animation Name) to put a 1 frame copy of the end of the pose, used as “backup”.

Hi mlindborg

How do I do this?

:slight_smile:

Create a variable, set it to Anim Sequence, make it an array

In the Event Graph I create an array? And how is it called, “Set Array Elem” or “Add”?

I also created a variable and tried to put it in the Animation Sequence… Is that what you mean by Anim Sequence? Anim Sequence = Animation Sequence? Or is it something else that I don’t know?

No, in the Variables tab. The variable type is Anim Sequence.

TBH, if you want a very straight forward setup, just add a Random Sequence Player node in the random idle state and assign your animations to it. Enable “Automatic Rule Based on etc…” on the transitions between idles and it will switch between states when the animation finishes.

Thank you!

I will start a new project with the very straight forward setup; that was all I needed.

[FONT=courier new]Make a new Animation Blueprint > open it > go to AnimGraph > create a New State Machine (named: Locomotion) > open it > add a New State (named: Idle) > double-click the Idle (State) > create a New State Machine (named: Idle State Machine) > open it > add a New State (named: Base Idle) > add a New State (named: Random Idle).
Enter the Random Idle (State), and create a Random Sequence Player; click on it, go to Details and under Setting, on the side of Entries, click on “+” to Add Elements (to the Array). Add as many Elements as the number of the random idle animations that will be used (starting from 0).

Return to the Idle State Machine, click once on the transition between Base Idle and Random Idle, and in the Details, under Transition, enable “Automatic Rule Based on Sequence Player in State”.

Double-click the Base Idle (State) and connect the Output Animation Pose to the Base Idle (Animation). [FONT=comic sans ms]I hope this is right.

Return to the Idle State Machine, and double-click on the transitions.

What do we do in the transitions to make it work? It says we have to connect something to Can Enter Transition.

Nothing, just enable this