Start animation at random time

Hi everyone.
I have a jellyfish placed a multiple times over my level.
Their animation is controlled by an animation blueprint.
The problems is that the animation loops at the same time.
I tried using the override animation data node with success;
they all swim at a different time but it will discard the animation blueprint,
and I don’t want that because without the ANIM_BP it can’t find back the curve

You can, for example, pause the animation for a small random period of time at the beginning, either in the BP animation or in the jellyfish BP:

Note that this will only pause/resume the animation. Everything else runs normally.

2 Likes

Give your jellyfish AnimBP a variable called “randomAnimationOffset” of a float type. Randomise this float on Event Initialize Animation. If your animation is in a state machine, you can expose the pin for “start position”, and use “randomAnimationOffset” to drive that. I believe this should work… and you could reuse that for any other looping animations you have.

The caveat for “Start Position” pin is that it is only updated on reinitialization, and setting the value in Event Initialize Animation (or Begin Play) is too late for the first cycle (see the tooltip docs for this pin). I believe reinitialization can be controlled a few different ways within the animation graph (ie “Reset Child on Activation” in Blend Poses node and “Reinitialize on Becoming Relevant” on state machine nodes) , I have not found a way to do it via Event Graph (ie blueprint proper).

The random pause at start route can be much more effective, because if you happen to have a base Character class like I do, you can achieve random offsets for all of your character types (with all of their distinct animation blueprints) with a tiny bit of code, instead of having to modify each individual blend space and animation sequence that is part of your animation blueprint (and if you leverage Blend Pose nodes for varying the actual animations played like I do, that can be quite a lot of nodes to change).

I do recommend exposing the Play Rate pin and using a random value for that (I used 0.8-1.2) in addition to the random pause mechanism. Play Rate can be changed at any time, not just during reinitialization, so the same issue does not apply.

1 Like

Doesn’t seem towork with a state machine that triggers the animation. I set the mesh to pause animation, but it still plays the animation when I trigger the “open” bool.

I too would love to be able to start at long animation at a random frame. This simple feature does not seem to work. It’s possible to change the play rate but not the start position (face palm)

Worlds most hacky solution here:


set a high play rate to begin with then a random delay then set the play rate back to 1
The anim plays really fast then begins at a ‘hopefully’ random point. An initial rate or 400 for a 1m26 anim goes like a flash. The animation would take .26 seconds to play at this speed. Setting a delay between .1 and .2 should give a start point somewhere in the middle.

1 Like