Hey,
I would like to create an exploding object. all I would like it to do, is to apply force to all nearby objects based on distance, thus form an explosion.
Now if I had a couple of dozen objects or more, iterating everything could be a problem before every single explosion occurs. So I was wondering if there is a pre exisiting something or other such as Space.Explode(force, Radius) somewhere, and if not, what would be the best way to go about making one?
I don't want destroyable houses, or a million peices of junk flying about, but just a quick force push around my player controlled ball.
Any advice would be appreciated.
How to Explode? Blasting whatever is nearby...
-
- Posts: 8
- Joined: Thu May 06, 2010 7:30 am
Re: How to Explode? Blasting whatever is nearby...
There actually is an "Explosion" class in BEPUphysics, though it's a bit dated. It also does a little more work than just a simple distance check.
However, the broadphase supports bounding volume queries (space.broadPhase.getEntities) to efficiently collect candidate objects. You could then apply a simple force (entity.applyImpulse) based on distance (squared) to each entity.
However, the broadphase supports bounding volume queries (space.broadPhase.getEntities) to efficiently collect candidate objects. You could then apply a simple force (entity.applyImpulse) based on distance (squared) to each entity.
-
- Posts: 8
- Joined: Thu May 06, 2010 7:30 am
Re: How to Explode? Blasting whatever is nearby...
This has got to be in the top 5 most convenient functions I have ever encountered. This and some distance math, and I can force push all the other balls lying around my level. Thanks for the help!Norbo wrote:the broadphase supports bounding volume queries (space.broadPhase.getEntities)