onBeforePhysicsObservable withou a physics engine?

Not sure if my question makes sense, but Im creating a game with a custom physics, but I create that physic as a simple module, not adding it as a actuall physics and I faced a problem that since my timesteps vary, my physics can be kinda wird sometimes due to the variation of deltaTime.

To fix that I thought to add a phyaics engine just to make the onBeforePhysicsObservable work (was using onBeforeRenderObservable) so I would have a fixed timestep, but Im not sure if thats too crazy, wanted to hear about it.

Good to mention that I didnt implemented the babylon physics interface just because I thought it would be too complicated and would need to create more stuff on my own physics that it actually dont need so I didnt look much at it, but Im not sure either if it is too complex like that

cc @Cedric

1 Like

Did you try to accumulate deltas and do tick updates with smaller fixed time steps like this ?

1 Like

Was avoiding doing something like that cause it looks so “out of the engine” :dizzy_face:

But maybe Im thinking too much around that :thinking:

It’s pretty common.
I know for some racing games, they had 1000Hz physics update. They did something like that to have small delta time consistent with a variable frame rate.
Decoupling updates and rendering is a good thing. Rendering is then a snapshot, potentialy with interpolation of the state of the various sub systems.

1 Like

Ohh, alrigth then!

I’ll give that a shot! Thank you!