[Box2D] Is it possible to apply different timesteps to bodies in one world?

I’m playing around with a slow-motion mechanic (or “bullet-time” like in Max Payne) in my game, and it pretty much works as expected: I decrease the time step (e.g. - from 1/60 to 1/300) and the simulation will slow down.

However, I think I want to explore a game mechanic where, upon triggering “bullet-time”/“slo-mo”, the main character controlled by the player doesn’t slow down but everything else around him does.

So if there’s a way to scale the timestep up/down for specific bodies in the physics simulation, that would be great.

If not, how would you suggest I try applying this game mechanic with Box2D? Thanks!

The Box2D bundled in libgdx or the Java port?

The one bundled with libgdx.

I’m 99% sure you can’t.

It matters which one because LibGDX uses the C++ Box2D implementation (the original) and interfaces with the Java code through JNI.

If you were using the JBox2D library you can override a few methods and get that to work.

Some people suggest to just change gravity… but that clearly isn’t the same.

Good luck with what you’re trying to do!