Creating a "leading" flashlight, but need to smooth it out.

I’m implementing a “leading” flashlight that moves ahead of the player’s rotation. I’ve tried the spring arm (boom) which is smooth, but when strafing or moving backwards it’s very janky and shakes all over. (I’ve tried a workaround that detects if the player is strafing and disables the “leading” and forces the flashlight forwards only, but this still has the occasional janky movements, so it’s not perfect.)

To alleviate this, I am now just simply coding it myself, and it works fine without any of the previous jankyness, only it’s not “smooth”. It does what it’s supposed to, but I’d like to try to smooth out the movement instead of it jumping to the new rotations. Tried an RInterp, but that didn’t seem to help. (Admittedly, I could have been doing something wrong.)

Here’s where I’m at. This is just a simple spotlight attached to the player’s head socket, and facing directly forwards, obviously. (And yes, I know that head socket will give me the “bounce” when the player character is moving, and that’s intended and why I put it there.) It grabs the player’s current rotation and finds the pitch and yaw difference from the previous location, applies a multiplier to the difference, then adds it to the current rotation and sets the flashlight’s rotation accordingly.

I’m attaching a shot of the blueprint code that handles this. Any advice or help would be appreciated. Something to at least prod me in the right direction.

Thanks!

-Marc

I’d use Base Aim Rotation from Pawn. It is the aim rotation…what it’s looking at.