Hello monkies. As the title suggests I have a question about ray casting/tracing to pick objects (Is there a difference between the two?). What I’ve noticed is that the collision result data will have two entries for the same object, one collision on the way in and one collision on the way out. Normally not a problem but in my particular circumstances it’s complicating things for me. An easy solution would be checking if the poly collided with is being backface culled or not. If it’s not (it’s facing the camera) then use that collision result. If it is (it’s facing away from the camera) ignore it. Is there an easy way to check for this quality?
Thanks for reading ^^
The distance? Oh, and the geometry you get, you can check the getAdditionalRenderState() for culling.
taken from https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_picking
// The closest collision point is what was truly hit:
CollisionResult closest = results.getClosestCollision();
Check if the normal dot camera direction is negative … I think there was a question about this before already …
Check if normal dot camera is negative. That’ll do it, thank you.
As for
// The closest collision point is what was truly hit:
CollisionResult closest = results.getClosestCollision();
I wonder, if you have two polygons occupying the exact same plane, but one of them is facing away from the camera and therefore backface culled, and then you ray trace collision results through them, which poly would show up first, and is it always consistently that way?