2013-11-21 17:22:13 +01:00
|
|
|
#ifndef OYSTER_PHYSICS_SIMPLE_RIGIDBODY_H
|
|
|
|
#define OYSTER_PHYSICS_SIMPLE_RIGIDBODY_H
|
|
|
|
|
|
|
|
#include "..\PhysicsAPI.h"
|
2014-02-09 21:24:09 +01:00
|
|
|
#include <btBulletDynamicsCommon.h>
|
2013-11-21 17:22:13 +01:00
|
|
|
|
2014-02-10 13:55:01 +01:00
|
|
|
namespace Oyster
|
|
|
|
{
|
|
|
|
namespace Physics
|
2013-11-21 17:22:13 +01:00
|
|
|
{
|
2014-02-10 13:55:01 +01:00
|
|
|
class SimpleRigidBody : public ICustomBody
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SimpleRigidBody();
|
|
|
|
virtual ~SimpleRigidBody();
|
|
|
|
|
2014-02-10 14:50:40 +01:00
|
|
|
State GetState() const;
|
|
|
|
State& GetState( State &targetMem ) const;
|
|
|
|
void SetState( const State &state );
|
|
|
|
|
2014-02-12 08:50:10 +01:00
|
|
|
void ApplyImpulse(Math::Float3 impulse);
|
2014-02-10 13:55:01 +01:00
|
|
|
|
|
|
|
void SetSubscription(EventAction_AfterCollisionResponse function);
|
|
|
|
void SetSubscription(EventAction_Move function);
|
|
|
|
|
2014-02-10 14:18:45 +01:00
|
|
|
void SetLinearVelocity(Math::Float3 velocity);
|
2014-02-11 09:15:21 +01:00
|
|
|
void SetPosition(Math::Float3 position);
|
2014-02-10 14:18:45 +01:00
|
|
|
void SetRotation(Math::Float4 quaternion);
|
2014-02-11 09:15:21 +01:00
|
|
|
void SetRotation(Math::Quaternion quaternion);
|
2014-02-10 14:18:45 +01:00
|
|
|
void SetRotation(Math::Float3 eulerAngles);
|
2014-02-13 19:49:33 +01:00
|
|
|
void SetRotation(::Oyster::Math::Float4x4 rotation);
|
2014-02-14 08:29:49 +01:00
|
|
|
void SetRotationAsAngularAxis(Math::Float4 angularAxis);
|
2014-02-11 09:15:21 +01:00
|
|
|
void SetAngularFactor(Math::Float factor);
|
2014-02-14 08:29:49 +01:00
|
|
|
void SetMass(Math::Float mass);
|
2014-02-11 09:15:21 +01:00
|
|
|
|
2014-02-11 13:09:46 +01:00
|
|
|
void SetGravity(Math::Float3 gravity);
|
|
|
|
|
2014-02-14 08:29:49 +01:00
|
|
|
void SetUpAndRight(Math::Float3 up, Math::Float3 right);
|
|
|
|
void SetUpAndForward(Math::Float3 up, Math::Float3 forward);
|
|
|
|
void SetUp(Math::Float3 up);
|
2014-02-10 14:18:45 +01:00
|
|
|
|
2014-02-10 14:39:45 +01:00
|
|
|
Math::Float4x4 GetRotation() const;
|
2014-02-11 13:53:44 +01:00
|
|
|
Math::Float4 GetRotationAsAngularAxis();
|
2014-02-10 14:39:45 +01:00
|
|
|
Math::Float4x4 GetOrientation() const;
|
|
|
|
Math::Float4x4 GetView() const;
|
2014-02-14 08:29:49 +01:00
|
|
|
Math::Float4x4 GetView( const Math::Float3 &offset ) const;
|
2014-02-10 14:39:45 +01:00
|
|
|
|
2014-02-13 19:49:33 +01:00
|
|
|
Math::Float3 GetGravity() const;
|
|
|
|
::Oyster::Math::Float3 GetLinearVelocity() const;
|
|
|
|
|
2014-02-10 13:55:01 +01:00
|
|
|
void CallSubscription_AfterCollisionResponse(ICustomBody* bodyA, ICustomBody* bodyB, Math::Float kineticEnergyLoss);
|
|
|
|
void CallSubscription_Move();
|
|
|
|
|
|
|
|
btCollisionShape* GetCollisionShape() const;
|
|
|
|
btDefaultMotionState* GetMotionState() const;
|
|
|
|
btRigidBody* GetRigidBody() const;
|
|
|
|
|
|
|
|
void SetCustomTag( void *ref );
|
|
|
|
void* GetCustomTag() const;
|
|
|
|
|
2014-02-13 19:49:33 +01:00
|
|
|
// Class specific
|
|
|
|
void SetCollisionShape(btCollisionShape* shape);
|
|
|
|
void SetMotionState(btDefaultMotionState* motionState);
|
|
|
|
void SetRigidBody(btRigidBody* rigidBody);
|
|
|
|
|
2014-02-10 13:55:01 +01:00
|
|
|
private:
|
2014-02-11 13:09:46 +01:00
|
|
|
|
2014-02-10 13:55:01 +01:00
|
|
|
btCollisionShape* collisionShape;
|
|
|
|
btDefaultMotionState* motionState;
|
|
|
|
btRigidBody* rigidBody;
|
|
|
|
|
|
|
|
Struct::CustomBodyState state;
|
|
|
|
|
|
|
|
EventAction_AfterCollisionResponse afterCollision;
|
|
|
|
EventAction_Move onMovement;
|
|
|
|
|
|
|
|
void *customTag;
|
2014-02-11 13:09:46 +01:00
|
|
|
|
|
|
|
::Oyster::Math::Float3 gravity;
|
2014-02-10 13:55:01 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2013-11-21 17:22:13 +01:00
|
|
|
|
|
|
|
#endif
|