bevy_rapier3d/geometry/shape_views/
cuboid.rs1use crate::math::Vect;
2use rapier::geometry::Cuboid;
3
4#[derive(Copy, Clone)]
6pub struct CuboidView<'a> {
7 pub raw: &'a Cuboid,
9}
10
11macro_rules! impl_ref_methods(
12 ($View: ident) => {
13 impl<'a> $View<'a> {
14 pub fn half_extents(&self) -> Vect {
16 self.raw.half_extents.into()
17 }
18 }
19 }
20);
21
22impl_ref_methods!(CuboidView);
23
24pub struct CuboidViewMut<'a> {
26 pub raw: &'a mut Cuboid,
28}
29
30impl_ref_methods!(CuboidViewMut);
31
32impl CuboidViewMut<'_> {
33 pub fn set_half_extents(&mut self, half_extents: Vect) {
35 self.raw.half_extents = half_extents.into();
36 }
37}