BlackPhlox / bevy_dolly

h3r2tic's dolly abstraction layer for the bevy game framework
Apache License 2.0
143 stars 22 forks source link

Change all "2" functionality to From impls #23

Closed janhohenheim closed 1 year ago

janhohenheim commented 1 year ago

By this I mean functions like transform_2_bevy. Because the numbers 2 and 3 have significant connotations in glam (and by extent Bevy) with the dimensionality, I was confused about this function. The rust ecosystem already provides a trait for exactly this kind of conversion, namely From and the automatically implemented To, so I suggest we use this instead. If you are fine with this change, I volunteer to implement it and setup a PR :)

BlackPhlox commented 1 year ago

Hi there 👋 Thanks for creating this issue

Yes, this is a bit of an oversight on my part, I think I started trying to use From but ran into impl From doesn't use only types from inside the current crate error and couldn't get wrapping the type to work (See: https://github.com/BlackPhlox/bevy_dolly/blob/aae4ce390ec7c2f8e299441a70725ea3b3833fac/src/map.rs#L83-L92)

You are very welcome to change it and create a PR <3