Skip to content

Fix: PointCloud pick with an Orthographic camera does not use mouse position #183

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jordan-Lane
Copy link
Contributor

PointCloudPicker.pick does not work for Orthographic cameras.

Typically when raycasting, the picking ray is generated using the ThreeJS method raycaster.setFromCamera(coords, camera). When this method is called with an Orthographic camera, the ray.direction will be the camera direction, and the ray.origin will be based on where the mouse is on the screen.

This is where the issue comes up. When calculating the pixelPosition in the pick method, we use the camera.position and then ray.direction. Therefore, regardless of where the mouse is on the screen, and Orthographic ray will always be projected from the center of the camera.

The solution here is to use the ray.origin instead of the camera.position to build the correct vector and then project it into camera space.

@Jordan-Lane Jordan-Lane changed the title PointCloud pick with an Orthographic camera does not use mouse position. Fix: PointCloud pick with an Orthographic camera does not use mouse position. Mar 25, 2025
@Jordan-Lane Jordan-Lane changed the title Fix: PointCloud pick with an Orthographic camera does not use mouse position. Fix: PointCloud pick with an Orthographic camera does not use mouse position Mar 25, 2025
@HectorArellanoDev
Copy link
Collaborator

Hello Jordan, I´m taking care of checking the PRS so I´ll be testing this feature, will get back to you this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants