I’m working on my view model for my FPS system and I ran into an issue regarding clamping the mouse delta. The mouse delta is being used as a way to add sway when you move your camera. The only issue is you can’t directly clamp the value. It’s being updated every frame, but the mouse delta’s quantitative size can change with the framerate.
Think about it: if the framerate is really low, the game sees the amount you moved your mouse that frame to be very large. If the framerate is high, this value will shrink as you’re checking the mouse delta more often. If you multiply by delta time, it ends up creating an inconsistent result across different framerates.
I do, however, want to limit how far the sway can make the view model physically move, so that it doesn’t move off screen. What’s the best way to go about this?