Make more Transform
APIs interoperate with Dir3
#12481
Labels
A-Math
Fundamental domain-agnostic mathematical operations
A-Transform
Translations, rotations and scales
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
D-Trivial
Nice and easy! A great choice to get started with Bevy
What problem does this solve or what need does it fill?
Presently,
Transform::look_to
andTransform::align
(along with other APIs derived from them) takeVec3
inputs even when their parameters are, morally speaking, directions. Conversions betweenVec3
andDir3
are annoying for end-users, and some of our other APIs provideDir3
, while doing mathematics 'by hand' often results in aVec3
, so simultaneously capturing these would be nice.What solution would you like?
After some discussion on Discord, it appears that using
impl TryInto<Dir3>
would be natural for these cases, since theyVec3 -> Dir3
would failThus, in particular, changing these inputs from
Vec3
toimpl TryInto<Dir3>
is not even a breaking change, but it would allowDir3
input to be given just as easily asVec3
.What alternative(s) have you considered?
Users can manually convert between
Vec3
andDir3
to get around this.Additional context
On the level of API design, just using
Dir3
was considered forTransform::align
because it is more "natural", but providing aDir3
is often not ergonomic (especially since theVec3
conversion is fallible) and becauseTransform::look_to
usedVec3
already.The text was updated successfully, but these errors were encountered: