bevy_fps_controller
bevy_fps_controller copied to clipboard
Mostly working Surf
I think I finally figured it out. Your choice to subtract toi from the Y velocity only at ground tick 1 was messing with later gravity calculations. From my testing, subtracting it every time doesn't seem to hamper bunny hopping acceleration, but let me know if there's a problem.
There are still some very minor details that make surfing here technically different to source engine surfing (e.g. holding forward doesn't pull you down), but I'd say it's pretty close.
Having given this some thought, this is probably still a naive solution, but it does help me narrow things down. From what I can tell, having debugged and stepped though the execution, the problem is still related to the gravity calculation:
$g = gravity \cdot g_e$
Considering we only care about the player entity, the entity gravity variable $g_e$ doesn't concern us. And you do calculate gravity in relation to deltatime. This leads me to believe that our problem might rest with how player movement physics in Half-Life is calculated via the virtual frame rate:
$f_p = \tau_p^{-1}$
Where $\tau_p$ is player frame rate, and $f_p$ is the resulting virtual frame rate used for calculations.