How to create animation and play it on key pressed?

Hi, I want to make an animation in which the first person character lifts their forearm in view of the first person camera on key press. And lowers it when key is pressed again. This needs to be able play whether the character is moving or idle, so detached from the rest of the body.

Also, the forearm needs to remain in view, even if the camera moves.

I don’t know much about animation. Can this be done in Unreal? Thanks.

Hello :slight_smile:

Of course it can be done but the question is quite broad and includes a lot of things that are hard to explain in text.

Check this tutorial out and write again if you still have trouble realizing your animation.

1 Like

Thanks. Do you know if you can do something like this through motion matching? It’s suppose to replace state machines from what I understand?

Like play an animation on key press, through motion matching?

In short: It is probably possible but surely unnecessary.

I haven’t dug deep into motion matching but the general idea is that the all animations clips have some additional data attached to them like “velocity vector”. You feed the Motion Matching System your data, your actual character velocity and your clips. The system then picks the animation clip with additional data that most closely matches (hence the name) the data you’ve provided (which is often the motion).

You can surely figure out a way to do it by adding some strange data your own clips and then trying to match it but it is an overkill in my opinion. The system is not build for that and I suspect you’ll find yourself fighting it.

I can’t be sure though so all power to you. If nothing else you’ll get to know what the limits of the system are.

1 Like