Radial Gravity with Particle Systems
(I'm not sure what category this should be under, so feel free to mark it under whatever is related to LiquidFun/Physics.)
LiquidFun's API allows for radial gravity via the ReportParticle callback of the QueryAABB and QueryShapeAABB methods. Note LiquidFun's methods ParticleApplyForce and ParticleApplyLinearImpulse.
Core features being requested:
- Expose LiquidFun's ParticleApplyForce and ParticleApplyLinearImpulse methods on ParticleSystem objects.
- Add an index property to the "hits" table returned from ParticleSystem:queryRegion()
- Expose LiquidFun's QueryShapeAABB method so we can query circular regions. This allows for more natural/accurate radial gravity behavior.
Alternatively, feel free to encapsulate these ideas into your own preferred methods. As long as it allows radial gravity with particle systems, then this feature request is satisfied.
Note: This feature request is not talking about display particles. This feature request is only talking about physics particles.
Nathan Phipps commented
To further clarify on core feature 2 (Add an index property to the "hits" table): The index property is the index from LiquidFun's QueryAABB and QueryShapeAABB methods. It's the index of the particle within the particle system. The user can use this property for the exposed methods of core feature 1.
local hits = particlesystem:queryRegion()
foreach particle in hits do particlesystem:ParticleApplyForce(particle.index, force.x, force.y) end