Is there a way to play an animation sequence from it’s first frame and then set it to loop ?
I have a ledge climbing system where I blend from an idle animation to a moving animation. My problem is that the animation blend randomly in the timeline of the animation. I need to restart the animation from 0 once it’s branch is active (when the blending from the idle to the moving animation start). Otherwise I get some nasty transitions because some poses in the animation are too far from the idle pose.
I was able to do it in UDK via a custom animation node, with something like this (unrealscript code) :
//when this node become active, we restart the animation from 0
//usefull for looping animation like ledge movements
event OnBecomeRelevant()
{
SetPosition(0.0f, false);
}
Is this possible in UE4 ? Do I need a custom node too for that ?
I tried to use a State machine with a entry and then an idle loop but it didn’t work. I could do a looping of a montage, but it’s really not an elegant and optimized solution in my opinion. :'|
I’d recommend using states with climb and idle and make sure you have blending time for transition to be 0.f so not to be not confused with blending vs playing from start.
If you look at the state, it should show, where the animation starts when it gets activated. Inside of state, we reinitialize it whenever gets activated, so it should work.
“Idle” is simply the idle animation when not moving along a ledge.
“LedgeLeftStart” is my moving animation to the left, but NOT looping.
“LedgeLeftLoop” is my moving animation to the left (the same one) but looping this time.
The condition to go from idle to LedgeLeftStart is just two boolean that I setup to know is the player is moving, and if he is moving to the left. If one of them is false, I got bakc to idle (hence the back and forth on the transitions o nthe graph).
The condition from LedgeLeftStart to LedgeLeftLoop is true if the animation from LedgeLeftStart has finished (and if the player is still moving), this means the first loop has been made and I can enter the loop state. The blending time between those two states is set to 0 as Lina mentioned. This way on the screen you have the feeling it’s the same animation that is looping. This is the most important part of the graph of course.