Smoothly returning control rotation with delta to original rotation while aiming

anonymous_user_87327337
Tue, 27 Mar 2018 14:46:28 +0000
Editor Scripting

Hi,

I have a recoil system that adds recoil in form of control rotation and it works great but I want to return the rotation to where I would aim WITHOUT the recoil I added (much like CS:GO where the aim “cools down”).
I have the added recoil saved as a rotation delta but I have problems with interpolating it back because I still want to be able to aim while it’s returning. I have everything, just the interpolation doesn’t seem to work as you can see.

Here is what I want without interpolation:

These are the variables I can work with:

The delta rotation (total recoil added during shooting)

“Origin” Control Rotation without recoil which still gets updated while aiming

obviously current control rotation of my pawn

I tried interpolating the delta to zero and and adding it to the origin control rotation but when I set the new delta rotation from the RInterpTo it jitters the camera a lot and is way to fast, no matter how low I set the Interp Speed. When I use lerp with a timeline it somehow inverts the control pitch, so I can’t aim while it is returning.

You can’t see that well but it jitters a lot and the control pitch is inverted again (I aim down when I pull my mouse up).

The “Add Rotators” Node is made by myself, it just adds the floats because I don’t want to combine the rotators.

1 post - 1 participant