-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Make converting positions to points easier #95
Comments
Stumbled here randomly, You should consider making a trait extension to get the point directly from position, probably with a more accurate name. |
It should be obvious what all these things return given that most have type annotations--often a requirement when using I know I can make an extension trait, but I don't think I should have to. Rapier already has lots of conversions, so running up against the lack of them here is a bit jarring. |
Adding (to |
Sure, but what relevant part of the position is lost when calculating distance between two points? Since rotation isn't relevant there anyway, what's the harm in dropping it if explicitly requested to do so? |
Yes, so writing |
I can respect that if it's your ultimate decision. But I'd counter that, if the type-checker wants a thing that behaves like it's idea of how a Either way, I'll be glad to see this get a bit easier to accomplish. Thanks. |
I often find myself doing something like:
let p1: Point<f32> = position.position.translation.vector.into();
if I want to get the distance between entities. This gets verbose quickly, especially with multiple entities.
I wonder if it makes sense to add the conversions higher up in the chain:
let p1: Point<f32> = position.position.translation.into();
Most straight-forward, since I'm working directly on the translation.
let p1: Point<f32> = position.position.into();
Unless there's some other, more meaningful point that can be derived from the isometry, this would be preferable since distance between positions seems common enough.
let p1: Point<f32> = position.into();
In general, if someone isn't interested in the next position, I'd argue that current should be the default assumption without having to be explicit about it every time. This makes calculating distances between two entities a whole lot cleaner:
let distance = na::distance(position1.into(), position2.into());
Thanks.
The text was updated successfully, but these errors were encountered: