From 916815e432bab0bcf326cc5475cd61148b89deb3 Mon Sep 17 00:00:00 2001 From: Sébastien Crozet Date: Tue, 21 Mar 2023 21:01:55 +0100 Subject: Give access to more vehicle controller fields --- src/control/ray_cast_vehicle_controller.rs | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/control/ray_cast_vehicle_controller.rs b/src/control/ray_cast_vehicle_controller.rs index 5daa435..1e2da51 100644 --- a/src/control/ray_cast_vehicle_controller.rs +++ b/src/control/ray_cast_vehicle_controller.rs @@ -200,6 +200,12 @@ impl Wheel { } } + /// Information about suspension and the ground obtained from the ray-casting + /// for this wheel. + pub fn raycast_info(&self) -> &RayCastInfo { + &self.raycast_info + } + /// The world-space center of the wheel. pub fn center(&self) -> Point { self.center @@ -216,15 +222,22 @@ impl Wheel { } } +/// Information about suspension and the ground obtained from the ray-casting +/// to simulate a wheel’s suspension. #[derive(Copy, Clone, Debug, PartialEq, Default)] -struct RayCastInfo { - // set by raycaster - contact_normal_ws: Vector, //contact normal - contact_point_ws: Point, //raycast hitpoint - suspension_length: Real, - hard_point_ws: Point, //raycast starting point - is_in_contact: bool, - ground_object: Option, +pub struct RayCastInfo { + /// The (world-space) contact normal between the wheel and the floor. + pub contact_normal_ws: Vector, + /// The (world-space) point hit by the wheel’s ray-cast. + pub contact_point_ws: Point, + /// The suspension length for the wheel. + pub suspension_length: Real, + /// The (world-space) starting point of the ray-cast. + pub hard_point_ws: Point, + /// Is the wheel in contact with the ground? + pub is_in_contact: bool, + /// The collider hit by the ray-cast. + pub ground_object: Option, } impl DynamicRayCastVehicleController { -- cgit