Skip to content

Commit

Permalink
Merge pull request #501 from dimforge/more-pub-vehicle
Browse files Browse the repository at this point in the history
Give access to more vehicle controller fields
  • Loading branch information
sebcrozet authored Jul 9, 2023
2 parents 13b290d + 916815e commit 958fba8
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/control/ray_cast_vehicle_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Real> {
self.center
Expand All @@ -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<Real>, //contact normal
contact_point_ws: Point<Real>, //raycast hitpoint
suspension_length: Real,
hard_point_ws: Point<Real>, //raycast starting point
is_in_contact: bool,
ground_object: Option<ColliderHandle>,
pub struct RayCastInfo {
/// The (world-space) contact normal between the wheel and the floor.
pub contact_normal_ws: Vector<Real>,
/// The (world-space) point hit by the wheel’s ray-cast.
pub contact_point_ws: Point<Real>,
/// The suspension length for the wheel.
pub suspension_length: Real,
/// 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 {
Expand Down

0 comments on commit 958fba8

Please sign in to comment.