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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
use na::Real;
use ncollide::world::{CollisionObject, CollisionObjectHandle, CollisionObjects};
use math::Isometry;
use object::{BodyHandle, Material};
pub type Colliders<'a, N> = CollisionObjects<'a, N, ColliderData<N>>;
pub type ColliderHandle = CollisionObjectHandle;
pub type Collider<N> = CollisionObject<N, ColliderData<N>>;
pub type SensorHandle = CollisionObjectHandle;
pub type Sensor<N> = CollisionObject<N, ColliderData<N>>;
pub struct ColliderData<N: Real> {
margin: N,
body: BodyHandle,
body_status_dependent_ndofs: usize,
position_wrt_body: Isometry<N>,
material: Material<N>,
}
impl<N: Real> ColliderData<N> {
pub fn new(
margin: N,
body: BodyHandle,
body_status_dependent_ndofs: usize,
position_wrt_body: Isometry<N>,
material: Material<N>,
) -> Self {
ColliderData {
margin,
body,
body_status_dependent_ndofs,
position_wrt_body,
material,
}
}
#[inline]
pub fn body(&self) -> BodyHandle {
self.body
}
#[inline]
pub fn margin(&self) -> N {
self.margin
}
#[inline]
pub fn position_wrt_body(&self) -> &Isometry<N> {
&self.position_wrt_body
}
#[inline]
pub fn material(&self) -> &Material<N> {
&self.material
}
#[inline]
pub(crate) fn body_status_dependent_ndofs(&self) -> usize {
self.body_status_dependent_ndofs
}
#[inline]
pub(crate) fn set_body_status_dependent_ndofs(&mut self, ndofs: usize) {
self.body_status_dependent_ndofs = ndofs
}
}