1
\$\begingroup\$

What is the preferred methods for doing so, performance-wise?

For example I want to pick certain objects in an area around a given point.

What I have thought off so far is using invisible objects as extended hit detectors. Like creating a circle or square then have collision responses to them.

Or maybe just pass the entire object list and iterate on it, then using a distance/angle based condition.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ I think you're referring to spatial partitioning. Virtual boundaries that group entities in separated lists. \$\endgroup\$ Commented May 30, 2013 at 12:00
  • \$\begingroup\$ Not really. For my collision detection + Physics I'm already using a quadtree. I'm talking about, for example, having a bomb object and calling its explode method. I would like to pick other objects within a radius and destroy them. \$\endgroup\$ Commented May 30, 2013 at 12:05
  • \$\begingroup\$ Well couldn't you just use that collision detection to detect a collision mesh like you suggested? It sounds like you already have the functionality for it. \$\endgroup\$ Commented May 30, 2013 at 12:09
  • 2
    \$\begingroup\$ I'd just like to point out that the way that this is worded is quite subjective at the minute - 'What are your preferred methods' (emphasis mine) does seem to set this up as a candidate for closing. IMHO, you should change that first sentence. \$\endgroup\$ Commented May 30, 2013 at 12:29

1 Answer 1

1
\$\begingroup\$

If you have a physics engine that is already capable of efficiently finding collisions between bounding shapes, generating a temporary shape (like a sphere) is common practice. If the physics engine has support for single-frame shape-collision queries, you could use that, but many will require you to create a new physics collision shape and then remember to remove it yourself after the next physics update.

You might want the object to exist more than one frame anyhow, for example maybe the effect you're looking for is to damage every enemy in contact with the explosion at 100 dmg/sec with the explosion lasting 3 seconds, so enemies can enter or leave the explosion and get less than the full 300 dmg it could do.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.