Set mass added

This commit is contained in:
Robin Engman 2014-02-14 08:29:49 +01:00
parent ff951d2183
commit 063f57133f
3 changed files with 15 additions and 5 deletions

View File

@ -184,6 +184,14 @@ void SimpleRigidBody::SetAngularFactor(Float factor)
this->rigidBody->setAngularFactor(factor);
}
void SimpleRigidBody::SetMass(Float mass)
{
btVector3 fallInertia(0, 0, 0);
collisionShape->calculateLocalInertia(mass, fallInertia);
this->rigidBody->setMassProps(mass, fallInertia);
this->state.mass = mass;
}
void SimpleRigidBody::SetGravity(Float3 gravity)
{
this->rigidBody->setGravity(btVector3(gravity.x, gravity.y, gravity.z));

View File

@ -29,20 +29,21 @@ namespace Oyster
void SetRotation(Math::Quaternion quaternion);
void SetRotation(Math::Float3 eulerAngles);
void SetRotation(::Oyster::Math::Float4x4 rotation);
void SetRotationAsAngularAxis(::Oyster::Math::Float4 angularAxis);
void SetRotationAsAngularAxis(Math::Float4 angularAxis);
void SetAngularFactor(Math::Float factor);
void SetMass(Math::Float mass);
void SetGravity(Math::Float3 gravity);
void SetUpAndRight(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 right);
void SetUpAndForward(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 forward);
void SetUp(::Oyster::Math::Float3 up);
void SetUpAndRight(Math::Float3 up, Math::Float3 right);
void SetUpAndForward(Math::Float3 up, Math::Float3 forward);
void SetUp(Math::Float3 up);
Math::Float4x4 GetRotation() const;
Math::Float4 GetRotationAsAngularAxis();
Math::Float4x4 GetOrientation() const;
Math::Float4x4 GetView() const;
Math::Float4x4 GetView( const ::Oyster::Math::Float3 &offset ) const;
Math::Float4x4 GetView( const Math::Float3 &offset ) const;
Math::Float3 GetGravity() const;
::Oyster::Math::Float3 GetLinearVelocity() const;

View File

@ -147,6 +147,7 @@ namespace Oyster
virtual void SetRotation(::Oyster::Math::Float4x4 rotation) = 0;
virtual void SetRotationAsAngularAxis(::Oyster::Math::Float4 angularAxis) = 0;
virtual void SetAngularFactor(::Oyster::Math::Float factor) = 0;
virtual void SetMass(::Oyster::Math::Float mass) = 0;
virtual void SetGravity(::Oyster::Math::Float3 gravity) = 0;