{"issue":{"milestone":null,"user":{"id":451405,"login":"onedayitwillmake","url":"https://api.github.com/users/onedayitwillmake","avatar_url":"https://secure.gravatar.com/avatar/f060b53dd18010b7167d5a0b505c8f78?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"f060b53dd18010b7167d5a0b505c8f78"},"title":"Possible Glitch in Ray.distanceFromIntersection?","created_at":"2011-09-10T21:57:03Z","updated_at":"2011-12-17T15:12:26Z","labels":[],"state":"closed","id":1615881,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"html_url":"https://github.com/mrdoob/three.js/issues/523","closed_at":"2011-09-17T00:27:19Z","body":"I have a very large plane, about 500,000 units across and high that I use for ray casting into a gameworld. However when facing left at somewhat acute angles the method `ray.intersectObject( largePlane )` was returning false.\r\n\r\nHowever when I step into the function I see the method was returning null after `function distanceFromIntersection( origin, direction, position )` - specifically the calculation \r\n\r\n\t\t\tvar vector, dot, intersect, distance;\r\n\r\n\t\t\tvector = position.clone().subSelf( origin );\r\n\t\t\tdot = vector.dot( direction );\r\n\r\n\t\t\tif ( dot <= 0 ) return null; // check if position behind origin.\r\n\r\nWas returning a very high negative number, if i comment out `if ( dot <= 0 ) return null;` line, it works fine and the correct position on the plane is received. \r\n\r\nHere's how i'm calling the code, it's basically what I saw in the examples:\r\n\r\n\t\t\tvar vector = new THREE.Vector3( this._mousePosition.x, this._mousePosition.y, 0.5 );\r\n\t\t\tprojector.unprojectVector( vector, camera );\r\n\t\t\tvar ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );\r\n\t\t\tvar intersects = ray.intersectObject( rayplane );","number":523,"url":"https://api.github.com/repos/mrdoob/three.js/issues/523","comments":2,"assignee":null},"comment":{"user":{"id":804941,"login":"remoe","url":"https://api.github.com/users/remoe","avatar_url":"https://secure.gravatar.com/avatar/d8ddea8c595cf0ae9a3878d11103a520?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"d8ddea8c595cf0ae9a3878d11103a520"},"created_at":"2011-12-17T15:12:26Z","updated_at":"2011-12-17T15:12:26Z","id":3189763,"body":"@mrdoob, i've also have a problem with this \"dot factor\". do you really sure this calculation for \"behind origin\" works on every case ? I play with that http://www.falstad.com/dotproduct/ .\r\n","url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/3189763"},"action":"created"}