Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2009-03-09 07:21:28 +0300
committerErwin Coumans <blender@erwincoumans.com>2009-03-09 07:21:28 +0300
commitabb338ddf9dea9a26ca1092b3f7fda86b32bbd16 (patch)
tree215d6b18fccc2705c4b2566f0dba3b11433bc6d5 /extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
parente4ce0d629e021bcc1b910a1f49c251a17501cff6 (diff)
upgrade to latest Bullet trunk, fix related to vehicle anti-roll, added constraint visualization.
This commit doesn't add new functionality, but more updates are planned before Blender 2.49 release.
Diffstat (limited to 'extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h')
-rw-r--r--extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h36
1 files changed, 25 insertions, 11 deletions
diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
index ec570cab875..da1fcb78611 100644
--- a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
+++ b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
@@ -45,7 +45,8 @@ class btRigidBody : public btCollisionObject
btVector3 m_linearVelocity;
btVector3 m_angularVelocity;
btScalar m_inverseMass;
- btScalar m_angularFactor;
+ btVector3 m_angularFactor;
+ btVector3 m_linearFactor;
btVector3 m_gravity;
btVector3 m_gravity_acceleration;
@@ -219,6 +220,14 @@ public:
void setMassProps(btScalar mass, const btVector3& inertia);
+ const btVector3& getLinearFactor() const
+ {
+ return m_linearFactor;
+ }
+ void setLinearFactor(const btVector3& linearFactor)
+ {
+ m_linearFactor = linearFactor;
+ }
btScalar getInvMass() const { return m_inverseMass; }
const btMatrix3x3& getInvInertiaTensorWorld() const {
return m_invInertiaTensorWorld;
@@ -230,7 +239,7 @@ public:
void applyCentralForce(const btVector3& force)
{
- m_totalForce += force;
+ m_totalForce += force*m_linearFactor;
}
const btVector3& getTotalForce()
@@ -261,23 +270,23 @@ public:
void applyTorque(const btVector3& torque)
{
- m_totalTorque += torque;
+ m_totalTorque += torque*m_angularFactor;
}
void applyForce(const btVector3& force, const btVector3& rel_pos)
{
applyCentralForce(force);
- applyTorque(rel_pos.cross(force)*m_angularFactor);
+ applyTorque(rel_pos.cross(force*m_linearFactor));
}
void applyCentralImpulse(const btVector3& impulse)
{
- m_linearVelocity += impulse * m_inverseMass;
+ m_linearVelocity += impulse *m_linearFactor * m_inverseMass;
}
void applyTorqueImpulse(const btVector3& torque)
{
- m_angularVelocity += m_invInertiaTensorWorld * torque;
+ m_angularVelocity += m_invInertiaTensorWorld * torque * m_angularFactor;
}
void applyImpulse(const btVector3& impulse, const btVector3& rel_pos)
@@ -287,7 +296,7 @@ public:
applyCentralImpulse(impulse);
if (m_angularFactor)
{
- applyTorqueImpulse(rel_pos.cross(impulse)*m_angularFactor);
+ applyTorqueImpulse(rel_pos.cross(impulse*m_linearFactor));
}
}
}
@@ -297,10 +306,10 @@ public:
{
if (m_inverseMass != btScalar(0.))
{
- m_linearVelocity += linearComponent*impulseMagnitude;
+ m_linearVelocity += linearComponent*m_linearFactor*impulseMagnitude;
if (m_angularFactor)
{
- m_angularVelocity += angularComponent*impulseMagnitude*m_angularFactor;
+ m_angularVelocity += angularComponent*m_angularFactor*impulseMagnitude;
}
}
}
@@ -450,11 +459,16 @@ public:
int m_contactSolverType;
int m_frictionSolverType;
- void setAngularFactor(btScalar angFac)
+ void setAngularFactor(const btVector3& angFac)
{
m_angularFactor = angFac;
}
- btScalar getAngularFactor() const
+
+ void setAngularFactor(btScalar angFac)
+ {
+ m_angularFactor.setValue(angFac,angFac,angFac);
+ }
+ const btVector3& getAngularFactor() const
{
return m_angularFactor;
}