Posted February 23, 2023 by Vrixic
After adding gravity to the grapple hook swing mechanic, the unreal physics system created a bug that was difficult to tackle at first glance.
BUG: The Grapple Hook swing changes based on the FPS of the game.
Video:
Problem: After creating the build for our game, the grapple hook swing mechanic got corrupted in that the velocity now changed based on the FPS the game was running at. Which created physics errors even when the swing was being handled correctly to blend well with any frame rate.
Tracking: The problem was to do with something with FPS and physics. Tracking it was kind of difficult as there were no code errors in the implementation of the grapple hook swing for calculations, but since I knew that the frame rate changed the grapple hook I knew it had something to do with unreal physics but how to fix it needed some research to be done.
Solution: After researching the problem for a bit, I ran into unreal documentation where it stated that all physics calculations did not exceed 60 FPS, meaning even if your running at 120 fps, physics was still being updated at 60 fps.
Implementing the fix: To fix it, I synced my swing calculations with unreal engines physics update time which then solved the inconsistency.
- Vrij Patel, VECCA Developer