Possible to pause 10 frame object animation on 9 and continue on key release?
I have what is intended to be a spring loaded lever that is pulled down with key press in its animation and flung up on key release. I am "porting" an old blender project to UE4 in which I had used 10 frames to achieve the desired result. I would play the animation from 0 to 9 (9th frame the lever is pulled at max) and run from frame 9 to 10 upon key release. The last frame is just a jump from max position to min. I can play the animation but I'm not seeing any options that indicate I can use this the same way. Would it be better to mocup a new 1 frame animation (though I'm not sure how to export two anims in an object from blender). If I were to import the same lever with just the last frame would I select the existing skeletal mesh I've already imported? I obviously wouldn't need another lever object just the new animation in the FBX.
I was thinking I could pause the animation with a notify on frame 9 but I'd rather not use animation blueprints. Perhaps it could be most effective to have two animations. In that case, I just need to know how to import it properly.
asked Apr 19 '18 at 06:16 PM in Blueprint Scripting
The short answer is: I think you're looking for "Set Play Rate", I'm pretty sure you can set the rate to 0.
Longer answer, two animations (one for down and one for up) is probably the cleanest way to do that, but if you only have one, I think you could do something fairly clean with anim notifies that would work pretty well.
First, you'll need to add an anim notify to your animation. It's not tricky, you just need to know where to look. These two things can probably set you right: https://docs.unrealengine.com/en-us/Engine/Animation/Sequences/Notifies https://www.unrealengine.com/en-US/blog/crash-course-in-animation-notifies
Put your notify at the moment the lever reaches its lowest point, and when it goes off pause the animation. If you're paused when the space bar is released, you just resume the animation.
One thing that I'm not clear on is if you intend for the lever to play its complete animation (all the way down, then back up) if the player just taps the spacebar for an instance. If you only want to pull the lever part way then go back up without playing the full top to bottom to top animation.... I'm not sure how you'd do that with the setup you're using (since you'd need to sync up the location you're at on the "down" part of the animation with the location you're at on the "back up" part of the animation.
Something a little messy to consider is only using the first half of the animation. Play it forward from the up position all the way to the down position and then pause. At any point in the animation, if the player releases space bar, you can play the animation backward ("Set Reverse") at a very high play rate. That way it will snap back to the start position from wherever it is in the down movement.
Follow this question
Once you sign in you will be able to subscribe for any updates here