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

Use Isometry in bevy_gizmos wherever we can #14676

Merged
merged 11 commits into from
Aug 28, 2024

Conversation

RobWalt
Copy link
Contributor

@RobWalt RobWalt commented Aug 9, 2024

Objective

Solution

  • go through the bevy_gizmos crate and give all methods a slight workover

Testing

  • For all the changed examples I run git switch main && cargo rr --example <X> && git switch <BRANCH> && cargo rr --example <X> and compare the visual results
  • Check if all doc tests are still compiling
  • Check the docs in general and update them !!!

Migration Guide

The gizmos methods function signature changes as follows:

  • 2D
    • if it took position & rotation_angle before -> Isometry2d::new(position, Rot2::radians(rotation_angle))
    • if it just took position before -> Isometry2d::from_translation(position)
  • 3D
    • if it took position & rotation before -> Isometry3d::new(position, rotation)
    • if it just took position before -> Isometry3d::from_translation(position)

@RobWalt RobWalt mentioned this pull request Aug 9, 2024
3 tasks
@BD103 BD103 added C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide A-Gizmos Visual editor and debug gizmos D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Aug 9, 2024
@RobWalt
Copy link
Contributor Author

RobWalt commented Aug 9, 2024

Here are just some screenshots. This PR also fixes the capsule and cylinder primitive rendering which was broken in the mean time somehow. (The circles connecting points with the orthogonal lines aren't exact)

Before:

image

image

After:

image

image


Funnily enough I also didn't change any parameters and I don't know why it looks so "simple" in the before-version 🤔

@RobWalt RobWalt marked this pull request as ready for review August 11, 2024 14:28
@RobWalt RobWalt force-pushed the isometry-all-the-gizmos branch from 93992c6 to e938ea3 Compare August 11, 2024 14:28
@alice-i-cecile alice-i-cecile added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Aug 19, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Aug 19, 2024
@RobWalt RobWalt force-pushed the isometry-all-the-gizmos branch from 98c534f to 48ef983 Compare August 19, 2024 13:34
@RobWalt RobWalt force-pushed the isometry-all-the-gizmos branch from c183242 to 08bfa92 Compare August 26, 2024 20:27
Copy link
Contributor

@NiseVoid NiseVoid left a comment

Choose a reason for hiding this comment

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

Haven't reviewed everything in detail, but the changes overall look fine to me. The changes from a direction to the weird Isometry::from_rotation(Quat::from_rotation_arc()) seems a but ugly, but I don't think we have a nicer solution for that currently.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 26, 2024
@janhohenheim
Copy link
Member

janhohenheim commented Aug 28, 2024

Wouldn't it be nicer to accept impl Into<Isometry3d> everywhere instead of Isometry3d? That would make this API a bit more robust regarding future usability additions.

@alice-i-cecile
Copy link
Member

Wouldn't it be nicer to accept impl Into<Isometry3d> everywhere instead of Isometry3d? That would make this API a bit more robust regarding future usability additions.

Possibly, but isometry is a really useful type, and that will increase complexity and compile times here.

@janhohenheim
Copy link
Member

@alice-i-cecile given that Bevy uses Transform nearly everywhere, I'd argue that accepting an impl would decrease complexity for users, as they don't need to care about the mathematical concepts at play here and can have it "just work". I agree that Isometry is cool, but I don't think most users will care about the difference between it and Transform.
Since setting up gizmos is not an operation that happens in many places, I'd be surprised if accepting an impl had any measurable effect on compile times for an average plugin.
This is not a strong opinion, feel free to disregard if you disagree.

@alice-i-cecile
Copy link
Member

Yeah I don't feel super strongly either, but I'd like to merge this as is and then refine later.

@janhohenheim
Copy link
Member

@alice-i-cecile that's fair :)

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 28, 2024
Merged via the queue into bevyengine:main with commit 8895113 Aug 28, 2024
27 checks passed
@RobWalt RobWalt deleted the isometry-all-the-gizmos branch August 28, 2024 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Gizmos Visual editor and debug gizmos C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide 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.

Tracking issue: Isometry follow-ups
5 participants