Slow motion physics

Hi guys,

I am attempting to add a slow motion feature to a physics based game. I have played with setTimeStep:

physics.setTimeStep( 1/120 )

This appears to give the right effect, however there is a problem with the object’s velocity. With timeStep set to 1/30 the object will fall with a maximum y velocity of 1800, however when set to 1/120 the object will reach around 4345 in free fall.

This number does not make any sense to me. If anything I would expect the falling velocity to be the same or at least a multiple of the original number. There is no linearDamping.

Have I misunderstood what physics.setTimeStep actually does? Playing with physics.setScale() and physics.setGravity() has only made things worse.

Any help would be appreciated.

box2d has a built-in velocity limit of 2 meters per time step.

(and you’re clearly still using the default scale 30px/m, so…)

in your first scenario (dt = 1/30s) you had hit that ceiling (30px/m * 30m/s*2 = 1800px/s) so your velocity was “capped”.

in the second scenario (dt = 1/120) you haven’t yet maxed out (cap = 7200), perhaps due to the finer integration,

in general, and if not  capped, then your approach should produce a nearly equivalent (not identical) “slow motion”

hth

Thank you for your response. I have applied a simple velocity cap when in slow motion mode. It will temporarily jump past the max velocity(if hit with a large force), but it’s good enough for my purposes.

Thank you for your help.

box2d has a built-in velocity limit of 2 meters per time step.

(and you’re clearly still using the default scale 30px/m, so…)

in your first scenario (dt = 1/30s) you had hit that ceiling (30px/m * 30m/s*2 = 1800px/s) so your velocity was “capped”.

in the second scenario (dt = 1/120) you haven’t yet maxed out (cap = 7200), perhaps due to the finer integration,

in general, and if not  capped, then your approach should produce a nearly equivalent (not identical) “slow motion”

hth

Thank you for your response. I have applied a simple velocity cap when in slow motion mode. It will temporarily jump past the max velocity(if hit with a large force), but it’s good enough for my purposes.

Thank you for your help.