Members - Reputation: 144
Posted 16 September 2012 - 11:48 AM
I am developing a 3D platformer game in XNA. Despite being a completely 3D, the player only moves on two dimensiones (2.5D). In this moment I am trying to detect colision between the main player and ground of the scene. For best performance, I implemented an octree in which I add all scene. Until now I have just used it to not having to paint the entire scene in each iteration of the main loop. The main player is not included in the octree and I don't know if I have to include it. I would not have to go completely octree for check if the player collision with the ground, is it possible?
Thanks in advance.
PD: Sorry for my English's level.
Crossbones+ - Reputation: 2918
Posted 16 September 2012 - 07:38 PM
In my opinion, your player doesn't have to be "in" the octree structure. You may well just run queries to the tree to find the nearest blocks to the player and then run your collision detection routine to the blocks you have found. Of course, if you'll need to implement entity vs player collision queries, then your player may have to part of the octree.
On the other hand, if your culling octree structure doesn't fit to your needs on collision detection, you may have another tree which suits better for finding the collision objects. As a matter of fact, typically these two needs don't go well together, at least in more complex scenarios.
The collision routine can be and should be something separated from your octree. The octree just is tree structure to accelerate spatial queries based on some criteria.