Added support for applying impulse

This commit is contained in:
Robin Engman 2014-02-12 08:50:10 +01:00
parent 5d245d7151
commit 7541994419
3 changed files with 9 additions and 0 deletions

View File

@ -67,6 +67,11 @@ void SimpleRigidBody::SetState( const SimpleRigidBody::State &state )
this->state = state; this->state = state;
} }
void SimpleRigidBody::ApplyImpulse(Float3 impulse)
{
this->rigidBody->applyImpulse(btVector3(impulse.x, impulse.y, impulse.z), btVector3(0.0f, 0.0f, 0.0f));
}
void SimpleRigidBody::SetCollisionShape(btCollisionShape* shape) void SimpleRigidBody::SetCollisionShape(btCollisionShape* shape)
{ {
this->collisionShape = shape; this->collisionShape = shape;

View File

@ -18,6 +18,8 @@ namespace Oyster
State& GetState( State &targetMem ) const; State& GetState( State &targetMem ) const;
void SetState( const State &state ); void SetState( const State &state );
void ApplyImpulse(Math::Float3 impulse);
void SetCollisionShape(btCollisionShape* shape); void SetCollisionShape(btCollisionShape* shape);
void SetMotionState(btDefaultMotionState* motionState); void SetMotionState(btDefaultMotionState* motionState);
void SetRigidBody(btRigidBody* rigidBody); void SetRigidBody(btRigidBody* rigidBody);

View File

@ -134,6 +134,8 @@ namespace Oyster
virtual void SetSubscription(EventAction_AfterCollisionResponse function) = 0; virtual void SetSubscription(EventAction_AfterCollisionResponse function) = 0;
virtual void SetSubscription(EventAction_Move function) = 0; virtual void SetSubscription(EventAction_Move function) = 0;
virtual void ApplyImpulse(::Oyster::Math::Float3 impulse) = 0;
virtual void SetLinearVelocity(::Oyster::Math::Float3 velocity) = 0; virtual void SetLinearVelocity(::Oyster::Math::Float3 velocity) = 0;
virtual void SetPosition(::Oyster::Math::Float3 position) = 0; virtual void SetPosition(::Oyster::Math::Float3 position) = 0;
virtual void SetRotation(::Oyster::Math::Float4 quaternion) = 0; virtual void SetRotation(::Oyster::Math::Float4 quaternion) = 0;