Sign in to follow this  
luke2

Object Visibility

Recommended Posts

luke2    100
I've been thinking lately about how I am going to implement various things for games im making; and one question/problem that has come up repeatedly is object visibility. By that I mean things like who decides when a bullet collides, the bullet, target, or some omnicient class? (Personally, Id think the omnicient class would be better than the target/bullet, and teh OC just sends a message to target/bullet saying they collided.) But should the omnicient class handle collision detection? or should it just ask for some sort of shape (an interface representing a sphere etc) and ask those interfaces if they've hit eachother... How do you guys deal with situations where many objects will need to know about eachother?

Share this post


Link to post
Share on other sites
ToohrVyk    1595
I use a HullCollider to determine when two hulls (a bounding volume + trajectory) collide. Then, specialized collision managers handle the specific object collisions based on hull collisions. For instance, a BulletEnemyCollider would test collisions between bullets and enemies by asking the HullCollider for collisions between their hulls, and then execute whatever is necessary for such a collision (usually involving double dispatch).

Share this post


Link to post
Share on other sites
luke2    100
Thankyou, but that doesn't really answer my question; you tell me how your collision detection works, but not how those two hulls know about eachother so that they can decide when they've collided. (I guess my example was somewhat vague)

Share this post


Link to post
Share on other sites
Quote:
Original post by luke2
Thankyou, but that doesn't really answer my question; you tell me how your collision detection works, but not how those two hulls know about eachother so that they can decide when they've collided. (I guess my example was somewhat vague)


Google stuff like "broad phase culling" and "narrow phase collision." Or take a look at how something like Bullet or ODE deal with collisions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this