Download

Counteract recoil

Hi,
Currently, I have a recoil system in place. It works by giving the controller pitch some input, and works as I intend. However, I then want it to go back to where it was (assuming the person has not given additional input. If they have, it should go back + or - the input they gave while the recoil was happening.) If you’ve ever played an FPS game, you know what I mean: the recoil will stop eventually and you’ll be back to where you were originally, if you haven’t move your mouse.


this is what I have so far, and clearly it’s not working. I don’t really know how I should do this. Any help is appreciated, thanks.

You should use Set Control rotation for this. Add controller pitch input is ‘adding’.

what I would do is have a float called recoilClimbTarget and set it to 0 by default, On tick always Have the Control Rotation (Pitch) FInterp To Target: recoilClimbTarget+CurrentControlPitch from Current: CurrentControlPitch.

Now upon shooting your weapon you will add some value to += recoilClimbTarget this will start moving your camera upwards.

To always return you will need another FInterp To for recoilClimbTarget which will always Current: recoilClimbTarget To Target: 0.0f. this depending on its Interp Speed will reset the recoilClimbTarget back to 0.