I’ve been tinkering with FPS mechanics within UE4 (super impressed so far) - and have successfully added recoil to the game, but since I’m inexperienced with game development and FPS creation, I am wondering if my solution is really the right way to go about this.
So what I ended up doing was using timeline and then the function “Add to controller input” - and set that to add the pitch.This rotates the camera over a specific period of time, which accumulates the total rotation over time. What I don’t like about this method, is I can’t use a value for what I want the total amount of rotation to be. Another issue I don’t like is timelines do not parameterize important attributes such as float curves or total length of time. To me, this is like “hard coding” the length of time and curve used, which is a bit disappointing, but maybe there is another way…
The method I have employed indeed works very well when tinkering with input values, but it’s not easy to figure out how much total rotation I want to apply. The only control I have is how much rotation I want to apply at each interval, and how long I want the entire interval to be.
For me, my design requirements are:
When I shoot a weapon, I want the player’s POV to rate upward to simulate recoil, and slowly rest back.
Different weapons should have different recoil, with some kicking up hard and returning slower, etc.
While my method achieves the result, it makes it hard for me to reuse this method across different weapons. IT seems like each weapon will need its own timeline/curves, and timelines cannot be passed around in functions which is annoying.
Rant aside, I wonder what the best practices are, and if there is a better approach with less caveats.