How to Explode? Blasting whatever is nearby...

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
MuletTheGreat
Posts: 8
Joined: Thu May 06, 2010 7:30 am

How to Explode? Blasting whatever is nearby...

Post 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.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

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

Post 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.
MuletTheGreat
Posts: 8
Joined: Thu May 06, 2010 7:30 am

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

Post 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!

:)
Post Reply