How to use OdeQuadTreeSpace

How to use OdeQuadTreeSpace ?? What should be passed to the constructor, and is there any example of using that?


I’m playing with ODE too. I managed to use a trimesh as a colliding surface, where many (ode) spheres interact. However, I felt a little bit dissapointed when framerate dropped to less than 25 with only 30 objects. I know that trimeshes are tricky but… only 30 objects?

Then I realized I was using the SimpleSpace… so I tried to use QuadTreeSpace instead, and I found this thread.

Well, according to ODE manual:

dSpaceID dQuadTreeSpaceCreate (dSpaceID space, dVector3 Center, dVector3 Extents, int Depth);

Creates a quadtree space: center and extents define the size of the root block. depth sets the depth of the tree - the number of blocks that are created is 4^depth.

So I tried in Panda with = OdeQuadTreeSpace((0, 0, 0), (2, 2, 2), 3)

and it worked… but the framerate didn’t rise. I though the extents vector was clearly too small for any world, so I changed it to (20,20,20), not really knowing if the scale is correct.

After a few frames, ODE crashes :frowning: The same if I use 6 depth levels. No way.

Are ODE spaces really working properly on Panda? :m Any known working example? Thanks!

Yes, they are working properly.
Performance problems can be solved by using multiple spaces and reparenting spaces to others.

Also, try the hash space - its easier to setup than the quadtree space (Default parameters are usually fine.), and copes with height also - if your level is mostly vertical the quad tree space will do little.

Thanks! The HashSpace works much better. Now I get around 80 spheres before framerate drops below 30.

I’ll play a little bit with HashSpace levels. This information from the ODE Wiki may be useful for anyone using Ode: