Hello,
Its been days since I am trying to have a polished recoil system for my FPS. And I just can’t figure how to finish it, the FInterp To node is so weird to me so I am asking for help here.
What I want is this :
The more the player is firing an automatic weapon, the more the bullet are spreading around the cursor, with a max value that is exposed.
A vertical pitch input each time a bullet is fired.
So the bullet spread is working fine, but I cant find any way to increase smoothly the pitch of the player. I first simply added a Pitch input on the player controller. It worked but it was “snapping” the new pitch value, so I started looking how to smooth it.
I discovered the FInterp To node wich seem to do what I want. So I created 2 variable in my weapon BP. “Current Pitch” float, wich I set everytime a bullet is fired by getting player controller and break rotator on Get Control rotation. After this, I increase a new variable “Target Pitch” by a float “Recoil Force” that I set at 1 for example.
And then, in the Event Tick, i call a function update Pitch with the finterp to return value. The FInterp To node is taking the Current Pitch as the “current” entry, “Target Pitch” as the Target entry, and Interp Speed that is exposed.
All of this is in my Weapon_BP parent class.
The result of this actually is when I fire with an automatic weapon ( semi not supported for now but I don"t mind I can fix it later ), the camera goes right to the ground instantly. If I shoot again it goes to the sky, like 180 degrees oposite. Sometimes it goes random. Its a bit hard to describe it because it seems so random.
I will send some screenshots of the function. I am also willing to go vocal discord if you prefer and if you have time.
thanks a lot !