bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.04k stars 3.44k forks source link

Tracking issue: Isometry follow-ups #14319

Closed mweatherley closed 1 week ago

mweatherley commented 1 month ago

14269 introduced isometry types to bevy_math. There are some places where it makes sense to integrate these that should probably be addressed in some fashion; the purpose of this issue is to track these.

These are all relatively similar in flavor, so it would be good if they blended harmoniously together (e.g. making it relatively easy to extract an Isometry3d from a Transform to position a sphere gizmo, for example).

alice-i-cecile commented 1 month ago

Gizmos could use isometries to position figures in addition to raw translation/rotations.

I'm quite nervous about doubling the API surface there for some sugar 🤔 Is there a benefit that I'm missing?

mweatherley commented 1 month ago

I'm quite nervous about doubling the API surface there for some sugar 🤔 Is there a benefit that I'm missing?

Well, I'm also nervous about it, but I think it's worth thinking about at least. My main thought here was mostly that the gizmo functions are essentially just indirectly asking for isometries as inputs — on the other hand, just changing the inputs to isometries seems like it could lead to poor ergonomics in cases where an isometry isn't readily on hand (since you'll have to call Isometry3d::new wrapping what you previously would have just passed as parameters). That's why I wrote "in addition to" above: I didn't really give much thought to the fact that that doubles the API surface, though.

As I write this, I'm becoming a little more skeptical that the "from raw parts" aspect will be typical if people are typically going to be extracting these from transforms, so maybe if the story for Transform -> Isometry3d is good, just taking isometries as inputs would be okay.

alice-i-cecile commented 1 month ago

so maybe if the story for Transform -> Isometry3d is good, just taking isometries as inputs would be okay.

Yeah, that makes sense to me. I think I'd be fine to swap to a pure Isometry API, assuming you can do .into from Transforms :)

RobWalt commented 1 month ago

Tackling gizmos in https://github.com/bevyengine/bevy/pull/14676 now