summaryrefslogtreecommitdiff
path: root/thirdparty/bullet/BulletDynamics/Dynamics/btRigidBody.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/bullet/BulletDynamics/Dynamics/btRigidBody.h')
-rw-r--r--thirdparty/bullet/BulletDynamics/Dynamics/btRigidBody.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/thirdparty/bullet/BulletDynamics/Dynamics/btRigidBody.h b/thirdparty/bullet/BulletDynamics/Dynamics/btRigidBody.h
index 05f270a4b8..39d47cbbda 100644
--- a/thirdparty/bullet/BulletDynamics/Dynamics/btRigidBody.h
+++ b/thirdparty/bullet/BulletDynamics/Dynamics/btRigidBody.h
@@ -205,6 +205,8 @@ public:
void saveKinematicState(btScalar step);
void applyGravity();
+
+ void clearGravity();
void setGravity(const btVector3& acceleration);
@@ -259,6 +261,7 @@ public:
m_invMass = m_linearFactor * m_inverseMass;
}
btScalar getInvMass() const { return m_inverseMass; }
+ btScalar getMass() const { return m_inverseMass == btScalar(0.) ? btScalar(0.) : btScalar(1.0) / m_inverseMass; }
const btMatrix3x3& getInvInertiaTensorWorld() const
{
return m_invInertiaTensorWorld;
@@ -331,6 +334,48 @@ public:
}
}
}
+
+ void applyPushImpulse(const btVector3& impulse, const btVector3& rel_pos)
+ {
+ if (m_inverseMass != btScalar(0.))
+ {
+ applyCentralPushImpulse(impulse);
+ if (m_angularFactor)
+ {
+ applyTorqueTurnImpulse(rel_pos.cross(impulse * m_linearFactor));
+ }
+ }
+ }
+
+ btVector3 getPushVelocity()
+ {
+ return m_pushVelocity;
+ }
+
+ btVector3 getTurnVelocity()
+ {
+ return m_turnVelocity;
+ }
+
+ void setPushVelocity(const btVector3& v)
+ {
+ m_pushVelocity = v;
+ }
+
+ void setTurnVelocity(const btVector3& v)
+ {
+ m_turnVelocity = v;
+ }
+
+ void applyCentralPushImpulse(const btVector3& impulse)
+ {
+ m_pushVelocity += impulse * m_linearFactor * m_inverseMass;
+ }
+
+ void applyTorqueTurnImpulse(const btVector3& torque)
+ {
+ m_turnVelocity += m_invInertiaTensorWorld * torque * m_angularFactor;
+ }
void clearForces()
{