google / liquidfun

2D physics engine for games
http://google.github.io/liquidfun
4.68k stars 641 forks source link

Compacting list is a big problem #112

Closed Leadwerks closed 2 years ago

Leadwerks commented 2 years ago

We're running physics at a fixed rate and interpolating motion between the last two physics steps. For this reason we need the current and previous position of a particle, but the self-compacting list feature causes the particle indexes to become invalid. How can we persistently track a single particle?

Manamongods commented 2 years ago

b2ParticleSystem::GetParticleHandleFromIndex should work

Leadwerks commented 2 years ago

Got it working, thanks.