CollisionTree & CollisionTreeManager

Hi everybody! Here I am again with my noob questions!  :smiley:



Looking at the jME doc I've found out these two class: CollisionTree and CollisionTreeManager. My question is simple: what they do exactly?How can I use them? Actually my collision system is based on OBB collision detection using hasCollision to detect collision and processCollision to handle them (like in flagrush tutorials).


These classes are mostly used internally to compute collisions when you call Node.hasCollision/findCollisions, etc. You can (and probably should) use CollisionTreeManager to fine tune collision tree generation for your nodes and such.

E.g you can use setCollisionTreeController() to configure when trees are deleted from the cache, generateCollisionTree() can be used to specify the type of collision tree to create (Type.AABB is preferable for terrains, while OBB might be better for props or game objects), you can also choose to "protect" a tree, this will prevent the system from removing it. You use updateCollisionTree() when the mesh of the model changes.

Can you give me an example of code, about the use of these classes? Or a link to a tutorial maybe?



Thx for your help!  :wink: