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.