Sign in to follow this  
Quat

Volumes

Recommended Posts

I'm wondering how to handle volumes (areas marked where you want something to happen when a player enters/leaves/is in the area). Should I keep a separate volume list and for each volume, and every update check if an object is in it? Or should I let the collision system handle it; for example, when a player intersects the trigger, the collision system could send a message to both the player and the volume object. Each volume could keep a list of game objects in it, so that it can test when a new object enters or an object leaves and react appropriately. Thoughts?

Share this post


Link to post
Share on other sites
It's essentially a collision check that you're doing, so why not use your collision system for it? As long as you keep in mind that you need to check against the volume and not just the hull, you should do fine. Why duplicate code and responsibilities?

As for storing game objects within this trigger (I assume you mean to store references to game objects), that's probably the best way to check when an object leaves the trigger, but you should leave entering the trigger up to moving objects themselves - when they end up within your trigger volume, the collision system will already notify your trigger, so there's no need for the trigger to poll for that.

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