New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For OrthographicCamera Raycaster.SetFromCamera() sets ray.origin in the near plane #9009
Comments
Setting it from the "near" clipping plane do make more sense. As any objects closer than the near clipping plane is not visible. Otherwise, you get some weird issue that the ray caster is hitting an object that's not visible due to it being "removed" by the near clipping plane. The raycaster.far not being the same distance as camera's far clipping plane may be something that's not intuitive. |
@wojdyr Yes, this has come up before. As you point out, the distance returned when raycasting using an orthographic camera is the distance from the near plane -- not the plane of the camera. The distance is still useful for sorting, however. Since we reject hits that fall outside the raycaster near and far planes, and since the distance calculation is not correct unless Who would like to propose a solution that works uniformly throughout the library? |
I have no idea what else would need to be changed in the library, but in this particular function ray.origin could be set in the camera plane by replacing
with |
@wojdyr That does appear to be correct, and the returned distance from raycasting matches the negative of the z-coordinate of the intersected point in camera space. |
mrdoob/three.js#9009 was fixed
For orthographic camera Raycaster.SetFromCamera() does:
which sets
ray.origin
in thecamera.near
clipping plane, not in the plane ofcamera.position
.So if I want to set, say,
raycaster.far
consistently withcamera.far
I do:(if this was intended just close this issue.)
Three.js version: r77
The text was updated successfully, but these errors were encountered: