Question about object picking

i'm using a ray to check if an object in under my invisible crosshair. it works fine, except that it checks for myself. i don't want a railgun to kill myself :frowning:

i cannot switch off myself being collidable because my child (a collision box) is still being picked and has isCollidable set. is this a bug?

It's not a bug, it's how you are checking for collision.  If you setup your scenegraph so that enemies (or other shootable objects) are under a different node than yourself, you can test for collision with the appropriate node and its children.  you could also ignore just yourself in the collision results.

my fault, i set a random object to uncollidable instead of myself.

next question:

the pickresult.getDistance() always is exactly 0. this IS a bug, right? or does it calculate the distance between the ray and the nodes bounds? this would make no sense, since i ask for contacts, so the distance between ray and node has to be 0.

You need to call setCheckDistance(true) on your PickResults if you want distances to be calculated (there's a cost involved,so it's false by default.)

renanse said:

You need to call setCheckDistance(true) on your PickResults if you want distances to be calculated (there's a cost involved,so it's false by default.)


yes on that topic. ive been using check distance instead of just go through the entire collision tree. for triangle pick, which way is more efficient?