Skip to content
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

Accept IntoIterator for Collider::compound instead of Vec #518

Open
Shatur opened this issue Sep 22, 2024 · 0 comments
Open

Accept IntoIterator for Collider::compound instead of Vec #518

Shatur opened this issue Sep 22, 2024 · 0 comments
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Usability A quality-of-life improvement that makes Avian easier to use

Comments

@Shatur
Copy link

Shatur commented Sep 22, 2024

You convert it into iterator anyway:

pub fn compound(
shapes: Vec<(
impl Into<Position>,
impl Into<Rotation>,
impl Into<Collider>,
)>,
) -> Self {
let shapes = shapes
.into_iter()
.map(|(p, r, c)| {
(
make_isometry(*p.into(), r.into()),
c.into().shape_scaled().clone(),
)
})
.collect::<Vec<_>>();

It would be nice to be able to avoid extra allocations.

@Jondolf Jondolf added A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Usability A quality-of-life improvement that makes Avian easier to use labels Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Usability A quality-of-life improvement that makes Avian easier to use
Projects
None yet
Development

No branches or pull requests

2 participants