Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
2  
I think you're referring to spatial partitioning. Virtual boundaries that group entities in separated lists. –  Sidar May 30 '13 at 12:00
    
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. –  user30893 May 30 '13 at 12:05
    
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. –  Sidar May 30 '13 at 12:09
2  
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. –  Polar May 30 '13 at 12:29

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.