diff options
| author | Sébastien Crozet <developer@crozet.re> | 2023-07-09 13:09:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-09 13:09:48 +0200 |
| commit | 958fba8ed43328e7e33bb9585a735577fa1061e1 (patch) | |
| tree | e558e9ff1b3a76f5a6d8065d67cd4dad9a8ccc4a | |
| parent | 13b290ddd0b14b7b856b605db3132a94145ec099 (diff) | |
| parent | 916815e432bab0bcf326cc5475cd61148b89deb3 (diff) | |
| download | rapier-958fba8ed43328e7e33bb9585a735577fa1061e1.tar.gz rapier-958fba8ed43328e7e33bb9585a735577fa1061e1.tar.bz2 rapier-958fba8ed43328e7e33bb9585a735577fa1061e1.zip | |
Merge pull request #501 from dimforge/more-pub-vehicle
Give access to more vehicle controller fields
| -rw-r--r-- | src/control/ray_cast_vehicle_controller.rs | 29 |
1 files changed, 21 insertions, 8 deletions
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<Real> { 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<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 { |
