How to implement physics sub-stepping?

Hello,

I’ve been searching around for a while but I can’t seem to find any snippets that have worked for me on Roblox. So, if anyone has managed to implement physics sub-stepping in your game before and wouldn’t mind sharing how you did so, that would be greatly appreciated!

I was trying to use this article, but I couldn’t get it working on Roblox.

Not possible on roblox unfortunately. Roblox engine task scheduler runs 60/s, and the physics engine is limited to that as well. The shortest time you can yield a thread is by 1 frame, because that is how the task library handles small wait numbers. Even if you could yield a thread by more, the physics engine is all synchronized to the scheduler, and does not support parallel luau, so any change would not apply until the next “Internal Physics Step”.

1 Like

As @mc3334 said altering Roblox’s timestep is not possible with the tools we are given.

Physics engine can actually change between 60hz 120 hz and 240 hz with the new adaptive timestepping, default is 240 hz.

However physics sub stepping is still possible but painful as you basically have to do it manually similar to the video below by predicting the value of forces half the time step and averaging the force. I’ve done it for my character controller similar to suspension which somewhat works.

It also gets more complicated to predict and calculate these forces if there are other factors such as roblox rotational dampening (this primarily stumpted me from applying it to a raycast 4 wheel suspension vehicle)

1 Like