Octree and collision detection

Hi,

I am currently working on my own Octree implementation and I had found this class at google code: Jme Octree

So, my question is: Is this class used in the core of jme or is it only a outdated tool? Because I found a horrible bug that could result in a wrong collision detection.

Here is the mentioned codesnippet at Octnode
[java]
private BoundingBox getChildBound(int side){
float extent = bbox.getXExtent() * 0.5f;
Vector3f center = new Vector3f(bbox.getCenter().x + extent * extentMult[side].x,
bbox.getCenter().y + extent * extentMult[side].y,
bbox.getCenter().z + extent * extentMult[side].z);
return new BoundingBox(center, extent, extent, extent);
}
[/java]

As long as the BoundingBox is a cube, this code works fine, but if its a long volume, the box is subdivided in the wrong way. This function should be like this:

[java]
private BoundingBox getChildBound(int side) {
float ex = bbox.getXExtent() * .5f;
float ey = bbox.getYExtent() * .5f;
float ez = bbox.getZExtent() * .5f;

    Vector3f center = new Vector3f(
            bbox.getCenter().x + ex * extentMult[side].x,
            bbox.getCenter().y + ey * extentMult[side].y,,
            bbox.getCenter().z + ez * extentMult[side].z,);
    return new BoundingBox(center, ex, ey, ez);
}

[/java]

So, makes it scene to “fix” this or is it better to drop this class if nobody uses it?

Thanks in advance and sorry for my bad English.

2 Likes

The only use of Octree I’m aware of is in /trunk/JmeTests/src/jme3test/tools/TestOctree.java
which unfortunately is broken as of 3.0.5. So I’m guessing Octree is not used much…

After discussion with the author, it appears the octree optimization code is outdated. The files will be removed in a future release.

Thanks for raising the issue, @florianbauer5 .

2 Likes

No, I have to thank @sgold