Add RigidBody::resetForce() and RigidBody::resetTorque() methods
This commit is contained in:
parent
22f9e5fc05
commit
2751bc5728
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -1,5 +1,21 @@
|
|||
# Changelog
|
||||
|
||||
## Release candidate
|
||||
|
||||
Note that this release contains some public API changes. Please read carefully the following changes before upgrading to this new version and
|
||||
do not hesitate to take a look at the user manual.
|
||||
|
||||
### Added
|
||||
|
||||
- Method RigidBody::resetForce() to reset the accumulated external force on a rigid body has beend added
|
||||
- Method RigidBody::resetTorque() to reset the accumulated external torque on a rigid body has beend added
|
||||
|
||||
### Changed
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
|
||||
## Version 0.8.0 (May 31, 2020)
|
||||
|
||||
Note that this release contains some public API changes. Please read carefully the following changes before upgrading to this new version and
|
||||
|
|
|
@ -165,6 +165,12 @@ class RigidBody : public CollisionBody {
|
|||
/// Apply an external torque to the body.
|
||||
void applyTorque(const Vector3& torque);
|
||||
|
||||
/// Reset the accumulated force to zero
|
||||
void resetForce();
|
||||
|
||||
/// Reset the accumulated torque to zero
|
||||
void resetTorque();
|
||||
|
||||
/// Return whether or not the body is allowed to sleep
|
||||
bool isAllowedToSleep() const;
|
||||
|
||||
|
|
|
@ -806,6 +806,26 @@ void RigidBody::applyTorque(const Vector3& torque) {
|
|||
mWorld.mRigidBodyComponents.setExternalTorque(mEntity, externalTorque + torque);
|
||||
}
|
||||
|
||||
// Reset the accumulated force to zero
|
||||
void RigidBody::resetForce() {
|
||||
|
||||
// If it is not a dynamic body, we do nothing
|
||||
if (mWorld.mRigidBodyComponents.getBodyType(mEntity) != BodyType::DYNAMIC) return;
|
||||
|
||||
// Set the external force to zero
|
||||
mWorld.mRigidBodyComponents.setExternalForce(mEntity, Vector3(0, 0, 0));
|
||||
}
|
||||
|
||||
// Reset the accumulated torque to zero
|
||||
void RigidBody::resetTorque() {
|
||||
|
||||
// If it is not a dynamic body, we do nothing
|
||||
if (mWorld.mRigidBodyComponents.getBodyType(mEntity) != BodyType::DYNAMIC) return;
|
||||
|
||||
// Set the external torque to zero
|
||||
mWorld.mRigidBodyComponents.setExternalTorque(mEntity, Vector3(0, 0, 0));
|
||||
}
|
||||
|
||||
// Set the variable to know whether or not the body is sleeping
|
||||
void RigidBody::setIsSleeping(bool isSleeping) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user