Skip to content

Commit 958fba8

Browse files
authored
Merge pull request #501 from dimforge/more-pub-vehicle
Give access to more vehicle controller fields
2 parents 13b290d + 916815e commit 958fba8

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/control/ray_cast_vehicle_controller.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ impl Wheel {
200200
}
201201
}
202202

203+
/// Information about suspension and the ground obtained from the ray-casting
204+
/// for this wheel.
205+
pub fn raycast_info(&self) -> &RayCastInfo {
206+
&self.raycast_info
207+
}
208+
203209
/// The world-space center of the wheel.
204210
pub fn center(&self) -> Point<Real> {
205211
self.center
@@ -216,15 +222,22 @@ impl Wheel {
216222
}
217223
}
218224

225+
/// Information about suspension and the ground obtained from the ray-casting
226+
/// to simulate a wheel’s suspension.
219227
#[derive(Copy, Clone, Debug, PartialEq, Default)]
220-
struct RayCastInfo {
221-
// set by raycaster
222-
contact_normal_ws: Vector<Real>, //contact normal
223-
contact_point_ws: Point<Real>, //raycast hitpoint
224-
suspension_length: Real,
225-
hard_point_ws: Point<Real>, //raycast starting point
226-
is_in_contact: bool,
227-
ground_object: Option<ColliderHandle>,
228+
pub struct RayCastInfo {
229+
/// The (world-space) contact normal between the wheel and the floor.
230+
pub contact_normal_ws: Vector<Real>,
231+
/// The (world-space) point hit by the wheel’s ray-cast.
232+
pub contact_point_ws: Point<Real>,
233+
/// The suspension length for the wheel.
234+
pub suspension_length: Real,
235+
/// The (world-space) starting point of the ray-cast.
236+
pub hard_point_ws: Point<Real>,
237+
/// Is the wheel in contact with the ground?
238+
pub is_in_contact: bool,
239+
/// The collider hit by the ray-cast.
240+
pub ground_object: Option<ColliderHandle>,
228241
}
229242

230243
impl DynamicRayCastVehicleController {

0 commit comments

Comments
 (0)