Sign in to follow this  

How are these called, and do they work like this?

This topic is 4713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, This is mostly about collision detection, and I'm sure it already exists: the world is divided into cubes, which are subdivided into more cubes, and so fort. Every cube has a boolean that indicates whether something or someone is in that cube. So, when an object is checked for collision, the game first checks the biggest cube he is in. When that is true, the same for the smaller ones, and so forth. Only when the smallest one where the player is in contains an object, real collision detection is done. When an object enters a smallest cube, that cube sets his flag to true, and tells his parent to do the same, and that parent his parent, and so forth. Now, I have two questions: - How is this called? Are these 'octrees'? (Which is the first name I thought of.. sounds logical too, as every part has 8 corners.) - For leaving the 'cube'. Should the 'cubes' keep a lists of contents, or should the system loop trough all objects to see if that cube is free again? Thanks While I described it in 3D, using the idea in 2D, or even 1D or 4D would be possible too, I guess

Share this post


Link to post
Share on other sites
Quote:
Original post by krez
yes and yes


To the first question, thanks, but to the second one.. which of them? Keep a list per cube (more memory) or loop trough objects (more cpu)?

Share this post


Link to post
Share on other sites
Well you have to keep track of which objects are in the same cube so you can do collision detection between them, but that information will change each frame as the positions of the objects are updated. So in a sense, you do both, however the list of objects per cube is only valid for that single frame.

Share this post


Link to post
Share on other sites
Each cube/node keeps it's own contents list. You then compare yourself to any other objects inside of your node(s). You would *not* compare yourself to all other objects in the world. As mentioned, this all requires some overhead of updating everyone's positions and the contents list of each node. But for large numbers of evenly-distributed objects, it can be very timesaving.

Share this post


Link to post
Share on other sites

This topic is 4713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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