[SOLVED] Ghost collision detected incorrectly (over-sensitive)

While I haven’t looked at Bullet’s math, this is somewhat common because most physics calculations tend to be done with 1/mass. So a lot of times, internally that’s what the physics engine will keep… and just pass 0 right through.

In those calculations where 1/mass is used, 0 automatically means ‘no impulse applied’, ie: infinite mass.

2 Likes

I don’t see how that could happen. Bullet subtracts the simulated substeps from m_localTime to prevent its value from ever becoming large:

That code has been in place since at least 2009.

Large number as in pos.x = 65,000.
Small number as in v.x * t = 0.0001

If there is enough disparity between big and small when doing addition, then the small number becomes 0 and nothing happens.

It’s not about the difference in time1 and time2 being wiped out because the times are big. It’s about actual velocity = 0.1 * timestep of 0.0167 being 0.00167.

If position is large enough that the math starts wiping out the lower digits of the smaller number then you either move strangely or don’t move at all.

Given that a standing character has 0 velocity, as it accelerates up to some reasonable velocity, it feels weird when all of the interim velocities jump in a stair step… or go directly from 0 to 1 or whatever.

v = v + a * t; // ok for most velocities
p = p + v * t; // only good for smallish p or largish v

2 Likes

got it, thanks!