|
This would work, but imagine the sphere is defined in a geometry file as a pile of triangles that is not known to be a sphere (no primitive). Then it breaks again.
I recognized something: at the time when the code was working correctly, the OrientedBoundingBox's internal attributes "_xAxis", "_yAxis", and "_zAxis" were different from (1,0,0) (0,1,0) (0,0,1) - according to the rotation.
The code
boundingBox.setXAxis(new Vector3(1, 0, 0));
boundingBox.setYAxis(new Vector3(0, 1, 0));
boundingBox.setZAxis(new Vector3(0, 0, 1));
fixed this issue and the bounding box was axis-aligned again. Everything was fine.
At the moment, the internal variables "_xAxis", "_yAxis", and "_zAxis" still have default direction (1,0,0) (0,1,0) (0,0,1) after the call to "spatial.getWorldBound().asType(Type.OBB);".
It seems like the rotation has no influence on the axis of the OrientedBoundingBox anymore - no idea why. I am sure that it had an influence before. Up to now, I could not reproduce the previous behavior.
Regards,
Stefan
|