bevy_rapier3d/geometry/shape_views/
cylinder.rs1use crate::math::Real;
2use rapier::parry::shape::Cylinder;
3
4#[derive(Copy, Clone)]
6pub struct CylinderView<'a> {
7 pub raw: &'a Cylinder,
9}
10
11macro_rules! impl_ref_methods(
12 ($View: ident) => {
13 impl<'a> $View<'a> {
14 pub fn half_height(&self) -> Real {
16 self.raw.half_height
17 }
18
19 pub fn radius(&self) -> Real {
21 self.raw.radius
22 }
23 }
24 }
25);
26
27impl_ref_methods!(CylinderView);
28
29pub struct CylinderViewMut<'a> {
31 pub raw: &'a mut Cylinder,
33}
34
35impl_ref_methods!(CylinderViewMut);
36
37impl CylinderViewMut<'_> {
38 pub fn set_half_height(&mut self, half_height: Real) {
40 self.raw.half_height = half_height;
41 }
42
43 pub fn set_radius(&mut self, radius: Real) {
45 self.raw.radius = radius;
46 }
47}