Merge pull request #429 from fabriceci/add-methods-retrieves-forces-and-torques
Adds methods to retrieve forces added by the user.
This commit is contained in:
@@ -9,6 +9,8 @@
|
|||||||
Disabling a multibody joint isn’t supported yet.
|
Disabling a multibody joint isn’t supported yet.
|
||||||
- Add `DynamicRayCastVehicleController`, a vehicle controller based on ray-casting and dynamic rigid-bodies (mostly
|
- Add `DynamicRayCastVehicleController`, a vehicle controller based on ray-casting and dynamic rigid-bodies (mostly
|
||||||
a port of the vehicle controller from Bullet physics).
|
a port of the vehicle controller from Bullet physics).
|
||||||
|
- Add `RigidBody::user_force` and `RigidBody::user_torque` to read the forces or torques added by the user to a
|
||||||
|
dynamic rigid-body.
|
||||||
|
|
||||||
### Modified
|
### Modified
|
||||||
- Add the `QueryPipeline` as an optional argument to `PhysicsPipeline::step` and `CollisionPipeline::step`. If this
|
- Add the `QueryPipeline` as an optional argument to `PhysicsPipeline::step` and `CollisionPipeline::step`. If this
|
||||||
|
|||||||
@@ -938,6 +938,28 @@ impl RigidBody {
|
|||||||
self.apply_impulse(impulse, wake_up);
|
self.apply_impulse(impulse, wake_up);
|
||||||
self.apply_torque_impulse(torque_impulse, wake_up);
|
self.apply_torque_impulse(torque_impulse, wake_up);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Retrieves the constant force(s) that the user has added to the body.
|
||||||
|
///
|
||||||
|
/// Returns zero if the rigid-body isn’t dynamic.
|
||||||
|
pub fn user_force(&self) -> Vector<Real> {
|
||||||
|
if self.body_type == RigidBodyType::Dynamic {
|
||||||
|
self.forces.user_force
|
||||||
|
} else {
|
||||||
|
Vector::zeros()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the constant torque(s) that the user has added to the body.
|
||||||
|
///
|
||||||
|
/// Returns zero if the rigid-body isn’t dynamic.
|
||||||
|
pub fn user_torque(&self) -> AngVector<Real> {
|
||||||
|
if self.body_type == RigidBodyType::Dynamic {
|
||||||
|
self.forces.user_torque
|
||||||
|
} else {
|
||||||
|
AngVector::zero()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RigidBody {
|
impl RigidBody {
|
||||||
|
|||||||
Reference in New Issue
Block a user