mrdoob/three.js — Issue #1328: Ray.intersectObject fails for small geometry
Author: ekitson
Created: 2012-02-14 23:07:16+00:00
State: open

We have some models that have very small geometry and I found I was not able to mouse pick them using the Ray class. I did some testing and found that the check on line 116 of Ray.js was failing. I changed the check from

`if ( Math.abs( dot ) < 0.0001 ) continue;`

to

`if ( dot === 0 ) continue;`

and then I was able to pick the small geometries. For reference, one of the geometries has a bounding sphere with radius 0.0225 and when I picked it, the value of `dot` was -0.0000466.

Obviously doing === is bad for floating point comparisons, so you need to have some sort of precision you check with. I looked through the code and it looks like Ray, Vector2, and Vector3 use 0.0001 and Quaternion uses 0.001. Could these be replaced with a `THREE.Precision` variable that defaults to 0.0001 but could be changed by users? Or is there just a minimum geometry size that is supported?