Give access to more vehicle controller fields

This commit is contained in:
Sébastien Crozet
2023-03-21 21:01:55 +01:00
committed by Sébastien Crozet
parent 13b290ddd0
commit 916815e432

View File

@@ -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. /// The world-space center of the wheel.
pub fn center(&self) -> Point<Real> { pub fn center(&self) -> Point<Real> {
self.center self.center
@@ -216,15 +222,22 @@ impl Wheel {
} }
} }
/// Information about suspension and the ground obtained from the ray-casting
/// to simulate a wheels suspension.
#[derive(Copy, Clone, Debug, PartialEq, Default)] #[derive(Copy, Clone, Debug, PartialEq, Default)]
struct RayCastInfo { pub struct RayCastInfo {
// set by raycaster /// The (world-space) contact normal between the wheel and the floor.
contact_normal_ws: Vector<Real>, //contact normal pub contact_normal_ws: Vector<Real>,
contact_point_ws: Point<Real>, //raycast hitpoint /// The (world-space) point hit by the wheels ray-cast.
suspension_length: Real, pub contact_point_ws: Point<Real>,
hard_point_ws: Point<Real>, //raycast starting point /// The suspension length for the wheel.
is_in_contact: bool, pub suspension_length: Real,
ground_object: Option<ColliderHandle>, /// The (world-space) starting point of the ray-cast.
pub hard_point_ws: Point<Real>,
/// Is the wheel in contact with the ground?
pub is_in_contact: bool,
/// The collider hit by the ray-cast.
pub ground_object: Option<ColliderHandle>,
} }
impl DynamicRayCastVehicleController { impl DynamicRayCastVehicleController {