bevy_rapier2d/geometry/shape_views/
compound.rs1use super::ColliderView;
2use crate::math::{Rot, Vect};
3use rapier::parry::shape::Compound;
4
5#[derive(Copy, Clone)]
7pub struct CompoundView<'a> {
8 pub raw: &'a Compound,
10}
11
12impl CompoundView<'_> {
13 #[inline]
15 pub fn shapes(&self) -> impl ExactSizeIterator<Item = (Vect, Rot, ColliderView<'_>)> {
16 self.raw.shapes().iter().map(|(pos, shape)| {
17 #[cfg(feature = "dim2")]
18 let rot = pos.rotation.angle();
19 #[cfg(feature = "dim3")]
20 let rot = pos.rotation;
21 (pos.translation, rot, shape.as_typed_shape().into())
22 })
23 }
24}