setMinimumExtent

Hello,



When updating the boundingbox for a plane that is perfectly aligned with x y or z the boundingbox seems to cause some unpredictability with findPick(). The reason is probably that one of the extents is 0 making it infinitely thin.



I suggest a setMinimumExtent(float f) on the BoundingBox or a workaround in findPick(). 


Can you doublecheck that the 0 width is really a problem - I did not notice that yet. Probably you can even propose a fix for the picking?  :slight_smile:

I made a little test program:

This calls findPick on the rootNode in simpleUpdate with a Ray(cam.getLocation(), cam.getDirection()) and setRandomColors on all meshes in the BoundingPickResult.



So when you aim at the Quad the colors should change constantly.



The pick seems to fail at certain distances between the origin of the ray and the target.


import com.jme.app.SimpleGame;
import com.jme.scene.shape.Quad;
import com.jme.bounding.BoundingBox;
import com.jme.scene.Text;
import com.jme.math.Vector3f;
import com.jme.intersection.BoundingPickResults;
import com.jme.math.Ray;
import com.jme.renderer.ColorRGBA;

public class BoundingPickTester extends SimpleGame{

Can you give numbers for a cases where the ray should hit but does not? That would help in making a testcase and thus find the actual bug.

irrisor said:

Can you give numbers for a cases where the ray should hit but does not? That would help in making a testcase and thus find the actual bug.


Could you be a bit more specific please? I don't understand what you mean.  :?

This was still on my todo list and I now tried to reproduce the effect but without success. Maybe it was another problem? Such as program hanging due to garbage colection etc.?

Well, the problem vanished when I made shure there was no 0 width bounding boxes. I am fairly convinced that this is the problem. Have you run the code I posted above?