diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/rigid_body.rs | 6 | ||||
| -rw-r--r-- | src/geometry/shape.rs | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index a1a23a0..303d1a0 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -370,6 +370,12 @@ impl RigidBody { self.apply_impulse(impulse, wake_up); self.apply_torque_impulse(torque_impulse, wake_up); } + + /// The velocity of the given world-space point on this rigid-body. + pub fn velocity_at_point(&self, point: &Point<f32>) -> Vector<f32> { + let dpt = point - self.world_com; + self.linvel + self.angvel.gcross(dpt) + } } /// A builder for rigid-bodies. diff --git a/src/geometry/shape.rs b/src/geometry/shape.rs index ec43bf7..5c96f68 100644 --- a/src/geometry/shape.rs +++ b/src/geometry/shape.rs @@ -64,6 +64,8 @@ pub trait Shape: RayCast<f32> + PointQuery<f32> + DowncastSync { None } + // TODO: add a compute_local_aabb method? + /// Computes the AABB of this shape. fn compute_aabb(&self, position: &Isometry<f32>) -> AABB<f32>; |
