Sign in to follow this  
rjackets

What to include in a quad/oct -tree?

Recommended Posts

Just a quick question. In regards to quad/oct-trees. Do I include non-static things like the position of my player(s) in this tree and move them around within it dynamically? Or is it mostly useful for "mostly-static" stuff like terrain, objects, etc. I can imagine that the number of things you need to check in an entire environment is much larger than checking 32 players (or whatever) to see if they need to be rendered. Nonetheless, i figure it couldn't hurt to double check. SUMMARY: Should oct/quad-tree be preloaded and include only static objects?

Share this post


Link to post
Share on other sites
Depending on your engine design, It might be beneficial to store within each Entity object a pointer to the tree node within which it currently resides. This will make for fast access to the node's data. However, this scheme imposes the association of your Octree and Entity structures, which might not be desirable.

Alternatively, instead of a pointer/reference to the respective octree node, you could store a unique integer octree_node id which will serve as an index to an array of pointers to all the tree's nodes. This array could reside within the Octree structure, thus eliminating the explicit dependency.

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