Page 1 of 1

How to Explode? Blasting whatever is nearby...

Posted: Thu May 06, 2010 8:19 am
by MuletTheGreat
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.

Re: How to Explode? Blasting whatever is nearby...

Posted: Thu May 06, 2010 8:49 am
by Norbo
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.

Re: How to Explode? Blasting whatever is nearby...

Posted: Fri May 07, 2010 8:44 am
by MuletTheGreat
Norbo wrote:the broadphase supports bounding volume queries (space.broadPhase.getEntities)
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!

:)