I now have a pretty decent physics engine to simulate the movement of a single object sliding across the ground and bouncing off of objects it collides with.
It’s completely server-sided. A single script with an Update() function called every RunService.Stepped, which does all the calculations and then updates the object’s position by an increment, and it runs very smoothly.
The problem shows up in collisions. Every frame, I use workspace:GetPartsInPart() to check when the object’s collided, and then cast a ray on all four sides of the object, as well as the top to find where the collided part is relative to the object, then use the normal vector of the Raycastresult to reflect the object in the opposite direction.
However, very often the Update() function doesn’t seem to be called fast enough each frame for the rays to hit the object, as in by the time the rays are cast, the object is already more that half way into the collided part, so no hit is detected. So as a result, sometimes when I run the engine, the object would reflect fine, but other times it would go through other parts and error out.
This issue clearly seems to rise from the fact that the time between each Stepped varies depending on how fast the machine is running, which I don’t have any control over, so I can’t even begin to think of how I would overcome this bug.
TL;DR: Run.Stepped fires inconsistently, which significantly impacts custom physics rendering. I’m just looking for a push in the right direction, like maybe a tweak to make my setup more optimal.