Oriented Bounding Box culling problem

I think that there are problems with the oriented bounding box culling.



When I create 2 spheres and I setup them Bounding Boxes or Bounding Sphere for bounding volumes, the culling works perfectly.

That is to say, when only one sphere is in the viewing frustum, the program said to me that it displays one mesh.



When I setup them Oriented Bounding Boxes for bounding volumes, the program never culls only one sphere. It culls either the both spheres or culls none of them.



I compared the code of BoundingBox and OrientedBoundingBox, and I think that the problem comes from OrientedBoundingBox.whichSide(Plane).

I changed it to this, copy/paste a part of BoundingBox.whichSide(Plane) on it  :smiley: :



        float fRadius = FastMath.abs(extent.x * (plane.getNormal().dot(xAxis)))

                + FastMath.abs(extent.y * (plane.getNormal().dot(yAxis)))

                + FastMath.abs(extent.z * (plane.getNormal().dot(zAxis)));

        float fDistance = plane.pseudoDistance(center);

        if (fDistance <= -fRadius)

            return Plane.NEGATIVE_SIDE;

        else if (fDistance >= fRadius) {

            return Plane.POSITIVE_SIDE;

        }

        else {

        return Plane.NO_SIDE;

        }




All seems to work now, but I'm not really sure to understand how it works  :?..



I want to know if my problem is really a jME bug, and if I'm right, If you could fix it…





Thanks !

Looks like a bug to me, I'll fix it.  Thanks.

Thank you too!