Three.js: Intersect should not pick invisible objects

Created on 17 Jul 2013  Â·  9Comments  Â·  Source: mrdoob/three.js

2277 was closed without comment. A ray should not intersect invisible objects; a cursory reading of the source doesn't appear to show any check for visible at all in that part of the code. And yes, I realize you could iterate the returned objects but I still maintain that it shouldn't be checking invisible objects at all. Or at least it could be a parameter somewhere.

Suggestion

Most helpful comment

Basically, Ray/Raycaster used to ignore invisible objects for a while, but then there were people that needed those to be checked too. So, instead of overcomplicating the code I opted for letting the user handle that instead.

So if you want Raycaster to not check invisible objects don't add those to the list of objects you're passing.

All 9 comments

Basically, Ray/Raycaster used to ignore invisible objects for a while, but then there were people that needed those to be checked too. So, instead of overcomplicating the code I opted for letting the user handle that instead.

So if you want Raycaster to not check invisible objects don't add those to the list of objects you're passing.

I already encounter this "issue"...
Is there a reason why we can't have a simple boolean "pickable" set to true by default in Object3D ?

Because right now if you got a huge scene with half of your object invisible your only option is to kept one array with the pickable stuffs and another with the invisible which might not be convenient. (you could also pick everything and take the nearest visible picked object but it would mean unnecessary computation...)

The only drawback (imho) for the "pickable" solution is the overhead a single "if" test in the raycasting....

Another option would be to add a boolean invisibleObjectsPickable argument to Raycaster.intersectObjects( objects, recursive ).

(there must be a better name than that)

Here's a previous discussion on this same subject: https://github.com/mrdoob/three.js/issues/1167

@mrdoob Should I close this or do you have a different fix in mind?

I think closing is fine...

On Thu, Jul 2, 2015 at 6:06 AM, dubejf [email protected] wrote:

@mrdoob https://github.com/mrdoob Should I close this or do you have a
different fix in mind?

—
Reply to this email directly or view it on GitHub
https://github.com/mrdoob/three.js/issues/3647#issuecomment-118026298.

Lets continue in #6757.

Actually, #6757 mutated...

Implemented 😅

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akshaysrin picture akshaysrin  Â·  3Comments

filharvey picture filharvey  Â·  3Comments

jlaquinte picture jlaquinte  Â·  3Comments

konijn picture konijn  Â·  3Comments

Horray picture Horray  Â·  3Comments