dimforge / dimforge/bevy_rapier

Make converting positions to points easier

Open
#95 6 comments 0 reactions 0 assignees View on GitHub
A-Integration C-Enhancement D-Easy P-Medium S-not-started
Dominant language
Rust
Stars
1.6k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

I often find myself doing something like:

`let p1: Point = 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 = position.position.translation.into();`

Most straight-forward, since I'm working directly on the translation.

`let p1: Point = 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 = 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.