Skip to content
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

Return pick ray in world coordinates with orthographic frustum #12500

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

andrewda
Copy link
Contributor

@andrewda andrewda commented Feb 28, 2025

Description

Currently, Camera.getPickRay returns results in different coordinate systems depending on whether a perspective or orthographic frustum is used. With a perspective frustum, getPickRay returns a ray in world coordinates, which is correct per the getPickRay docs. With an orthographic frustum (both 2D and 3D), on the other hand, getPickRay returns the ray in camera coordinates, which differs from the documentation. This also results in weird zooming behavior in 3D orthographic mode with a tracked entity.

CleanShot.2025-02-27.at.19.24.42.mp4

Note that this could be a breaking change if users have depended on getPickRay incorrectly returning results in camera coordinates.

Issue number and link

#12498
#11743

Testing plan

Added four additional tests to cover:

  1. get pick ray with lookAt in perspective 3D
  2. get pick ray with lookAt in orthographic 3D
  3. get pick ray with lookAt in orthographic 2D
  4. get pick ray with lookAt in orthographic Columbus view

Only test 1 (perspective 3D) currently passes on main. This PR resolves the remaining 3 tests.

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

Copy link

Thank you for the pull request, @andrewda!

✅ We can confirm we have a CLA on file for you.

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.

1 participant