Skip to content

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.

@HectorArellanoDev HectorArellanoDev merged commit f75a296 into pnext:master Jun 4, 2025
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