1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use crate::math::Real;
use rapier::parry::shape::Cone;
/// Read-only access to the properties of a cone.
#[derive(Copy, Clone)]
pub struct ConeView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Cone,
}
macro_rules! impl_ref_methods(
($View: ident) => {
impl<'a> $View<'a> {
/// The half-height of the cone.
pub fn half_height(&self) -> Real {
self.raw.half_height
}
/// The base radius of the cone.
pub fn radius(&self) -> Real {
self.raw.radius
}
}
}
);
impl_ref_methods!(ConeView);
/// Read-write access to the properties of a cone.
pub struct ConeViewMut<'a> {
/// The raw shape from Rapier.
pub raw: &'a mut Cone,
}
impl_ref_methods!(ConeViewMut);
impl<'a> ConeViewMut<'a> {
/// Set the half-height of the cone.
pub fn set_half_height(&mut self, half_height: Real) {
self.raw.half_height = half_height;
}
/// Set the radius of the basis of the cone.
pub fn set_radius(&mut self, radius: Real) {
self.raw.radius = radius;
}
}