couch/core/Rigidbody.h
2021-01-25 15:17:32 -06:00

41 lines
914 B
C++

#ifndef RIGIDBODY_H
#define RIGIDBODY_H
#include <btBulletDynamicsCommon.h>
#include "types.h"
#include "Spatial.h"
#include "CollisionShape.h"
class Rigidbody : public Spatial {
public:
Rigidbody();
virtual Rigidbody *Create();
virtual Rigidbody *Duplicate();
virtual Rigidbody *Instance();
void SetCollisionShape(CollisionShape collisionShape);
cfloat mass = 1.0f;
void ApplyImpulse(Vector3 impulse);
void ApplyForce(Vector3 force);
void SetCharacter(bool character);
private:
bool character = false;
btRigidBody *btBody;
btCollisionShape *collisionShape;
friend class World;
};
class RigidbodyMotionState : public btMotionState {
public:
RigidbodyMotionState(Rigidbody *rigidbody);
virtual void getWorldTransform(btTransform &worldTrans) const;
virtual void setWorldTransform(const btTransform &worldTrans);
private:
Rigidbody *rigidbody;
};
#endif /* RIGIDBODY_H */