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

Fix look_to resulting in NaN rotations #7817

Merged
merged 4 commits into from
Mar 15, 2023

Conversation

mockersf
Copy link
Member

@mockersf mockersf added the A-Transform Translations, rotations and scales label Feb 25, 2023
Copy link
Contributor

@nicopap nicopap left a comment

Choose a reason for hiding this comment

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

This is like Elm deciding that 1 / 0 = 0, it might not comply with the purely theoretical definition, but I personally think that functional beats pure. Especially if the selected fallback direction is clearly defined.

@@ -120,6 +120,11 @@ impl Transform {

/// Returns this [`Transform`] with a new rotation so that [`Transform::forward`]
/// points towards the `target` position and [`Transform::up`] points towards `up`.
///
/// In some cases it's not possible to construct a rotation. Another axis will be picked in those cases:
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this means we should be returning Result<Self, SomeError> instead, seems odd to silently fail here.

Copy link
Member

Choose a reason for hiding this comment

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

IMO we're not silently failing: we're performing a "best-attempt". I'd be open to try variants too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would prefer to work by default, instead of having to add unwrap / error management everywhere this pops up

@james7132 james7132 added the C-Bug An unexpected or incorrect behavior label Feb 25, 2023
@james7132 james7132 added this to the 0.11 milestone Mar 4, 2023
@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 Mar 15, 2023
Co-authored-by: Liam Gallagher <ljpgallagher@xtra.co.nz>
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Mar 15, 2023
Merged via the queue into bevyengine:main with commit b6b549e Mar 15, 2023
Shfty pushed a commit to shfty-rust/bevy that referenced this pull request Mar 19, 2023
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Liam Gallagher <ljpgallagher@xtra.co.nz>
Shfty pushed a commit to shfty-rust/bevy that referenced this pull request Mar 19, 2023
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Liam Gallagher <ljpgallagher@xtra.co.nz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Transform Translations, rotations and scales C-Bug An unexpected or incorrect behavior 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
6 participants