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

[Merged by Bors] - Add Camera::viewport_to_world #6126

Closed
wants to merge 6 commits into from

Conversation

tim-blackbird
Copy link
Contributor

Objective

Add a method for getting a world space ray from a viewport position.

Opted to add a Ray type to bevy_math instead of returning a tuple of Vec3's as this is clearer and easier to document
The docs on viewport_to_world are okay, but I'm not super happy with them.

Changelog

  • Add Camera::viewport_to_world
  • Add Camera::ndc_to_world
  • Add Ray to bevy_math
  • Some doc tweaks

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen A-Math Fundamental domain-agnostic mathematical operations C-Feature A new feature, making something new possible labels Sep 29, 2022
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent start. IMO we should a) have a method to intersect the ray with planes b) a 2D helper version on OrthographicProjection that returns an (x, y) coordinate.

@mockersf
Copy link
Member

In my opinion introducing plane intersection could happen in a followup PR if you prefer to keep this one small

@alice-i-cecile
Copy link
Member

Once the comment is recorded and repr(C) is removed I'm fine to approve this. The plane intersection can wait.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Sep 29, 2022
Co-authored-by: Nathan Ward <nathansward@comcast.net>
@alice-i-cecile
Copy link
Member

Merging as is; we can improve this later :)

bors r+

bors bot pushed a commit that referenced this pull request Oct 5, 2022
# Objective

Add a method for getting a world space ray from a viewport position.

Opted to add a `Ray` type to `bevy_math` instead of returning a tuple of `Vec3`'s as this is clearer and easier to document
The docs on `viewport_to_world` are okay, but I'm not super happy with them.

## Changelog
* Add `Camera::viewport_to_world`
* Add `Camera::ndc_to_world`
* Add `Ray` to `bevy_math`
* Some doc tweaks

Co-authored-by: devil-ira <justthecooldude@gmail.com>
@bors
Copy link
Contributor

bors bot commented Oct 5, 2022

Build failed:

@mockersf
Copy link
Member

mockersf commented Oct 5, 2022

bors retry

bors bot pushed a commit that referenced this pull request Oct 5, 2022
# Objective

Add a method for getting a world space ray from a viewport position.

Opted to add a `Ray` type to `bevy_math` instead of returning a tuple of `Vec3`'s as this is clearer and easier to document
The docs on `viewport_to_world` are okay, but I'm not super happy with them.

## Changelog
* Add `Camera::viewport_to_world`
* Add `Camera::ndc_to_world`
* Add `Ray` to `bevy_math`
* Some doc tweaks

Co-authored-by: devil-ira <justthecooldude@gmail.com>
@bors bors bot changed the title Add Camera::viewport_to_world [Merged by Bors] - Add Camera::viewport_to_world Oct 5, 2022
@bors bors bot closed this Oct 5, 2022
xgbwei pushed a commit to xgbwei/bevy that referenced this pull request Oct 5, 2022
# Objective

Add a method for getting a world space ray from a viewport position.

Opted to add a `Ray` type to `bevy_math` instead of returning a tuple of `Vec3`'s as this is clearer and easier to document
The docs on `viewport_to_world` are okay, but I'm not super happy with them.

## Changelog
* Add `Camera::viewport_to_world`
* Add `Camera::ndc_to_world`
* Add `Ray` to `bevy_math`
* Some doc tweaks

Co-authored-by: devil-ira <justthecooldude@gmail.com>
@tim-blackbird tim-blackbird deleted the viewport-to-ray branch October 13, 2022 13:13
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 19, 2022
# Objective

Add a method for getting a world space ray from a viewport position.

Opted to add a `Ray` type to `bevy_math` instead of returning a tuple of `Vec3`'s as this is clearer and easier to document
The docs on `viewport_to_world` are okay, but I'm not super happy with them.

## Changelog
* Add `Camera::viewport_to_world`
* Add `Camera::ndc_to_world`
* Add `Ray` to `bevy_math`
* Some doc tweaks

Co-authored-by: devil-ira <justthecooldude@gmail.com>
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
# Objective

Add a method for getting a world space ray from a viewport position.

Opted to add a `Ray` type to `bevy_math` instead of returning a tuple of `Vec3`'s as this is clearer and easier to document
The docs on `viewport_to_world` are okay, but I'm not super happy with them.

## Changelog
* Add `Camera::viewport_to_world`
* Add `Camera::ndc_to_world`
* Add `Ray` to `bevy_math`
* Some doc tweaks

Co-authored-by: devil-ira <justthecooldude@gmail.com>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

Add a method for getting a world space ray from a viewport position.

Opted to add a `Ray` type to `bevy_math` instead of returning a tuple of `Vec3`'s as this is clearer and easier to document
The docs on `viewport_to_world` are okay, but I'm not super happy with them.

## Changelog
* Add `Camera::viewport_to_world`
* Add `Camera::ndc_to_world`
* Add `Ray` to `bevy_math`
* Some doc tweaks

Co-authored-by: devil-ira <justthecooldude@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Math Fundamental domain-agnostic mathematical operations A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants