Skip to main content

1.4.0 picking problem

1 reply [Last post]
Joined: 2006-05-01

I'm making a collision detection (or actually collision avoidance) that shoots a pickray to the next position. If anything is in the way my method returns true. For this only the closest object is important.

And now the problem: sometimes the PickTool.pickClosest() returns an object while nothing seems to be in the way. I think it may have something to do with the pickray hitting a bounding box instead of the geometry. The documentation says "PickInfo.PICK_GEOMETRY will pick using the geometry of the pickable nodes. Geometry nodes in the scene must have the ALLOW_INTERSECT capability set for this mode.".

Does this mean that I have to set the capability for all nodes that I want collision detection with? And shouldn't I get a CapabilityNotSetException?

The collision detection code:

public boolean checkCollision(Point3d oldPosition,Point3d newPosition) {

boolean colliding=false;

PickTool picktool=new PickTool(root);

PickInfo pickinfo=picktool.pickClosest();

if (pickinfo!=null) {

return colliding;

Message was edited by: mrgol

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-03-17

As of Java 3D 1.4, the ALLOW_INTERSECT capability bit is set by default. See:

-- Kevin