Creating an animation for a held object (bug swatter)

Hey all! This is my first time doing something like this, so any help would be greatly appreciated.

Basically, what I’m trying to do: The player picks up a bug swatter with ‘E’, and then they click the left mouse button to swat with the bug swatter. What I’m stuck on is the actual swatting animation.

The way I have it set up currently is this: The player sends out a sphere trace when pressing ‘E’ to interact, and if the sphere trace hits the swatter (lying in a corner of the room), the swatter BP gets attached to a specific point on the player. Teleports into place instantly, as if you’ve quickly picked it up. Cheap looking but effective.

So, it’s attached to the player now, and it sticks in the player’s POV and moves around with the camera as the player looks around (the point the swatter sticks to is attached to the camera). Now all that’s left to do is the animation of the swatting, buuuuut, I’m not sure what to do from here. I tried it with a lerp but of course that didn’t work because the player’s camera is always moving, so the lerp can’t keep up with that, having fixed start and end rotations and all. I tried it that way and it’s unworkable as far as I can tell.
Here’s a video of the bug swatter system so far, and the failed lerp attempt. The lerp is working off of rotations it grabs when the player picks up the swatter, so of course it’s always rotating back to the same spot.

So, where do I go from here? I assume I have to make an animation for the bug swatter in order to get the effect I want (that effect being, a quick swat down and then back up to the standard holding position seen in the video after the player grabs the bug swatter).
Do I need to add bones to the bug swatter in blender (probably just one long bone down the whole thing, I’m thinking), and then create an anim montage with that skeletal mesh in unreal? Is that the most straightforward way to get an animation that I can call whenever the player taps left mouse, so the swatter does a quick swat and gets back to a normal holding position regardless of where the player is looking or if they’re moving?

Hey @MGRay!

You should attach a scene node component to your player and attach to that!

Then, you can use the rotation and position of that as the return for your LERP.
Are you using a timeline? How is the LERP working?

Let us know and bring pictures! :slight_smile: