#ifndef PHYSICS_OBJECT_H
#define PHYSICS_OBJECT_H

#include "physics/physics_world.h"

class GameObject;

class PhysicsObject
{
public:
	PhysicsObject();
	~PhysicsObject();

	void CreateTriMesh(const Vec3* vertices, const int verticesCount, const uint32_t* indices, const int indicesCount);
	void CreatePlayer();
	void CreateSimpleBox();
	void CreateSimpleBox_Kinematic();

	void Destroy();

	inline dGeomID				GetShape()			{ return (m_pCollisionShape); }
	inline dGeomID const		GetShape() const	{ return (m_pCollisionShape); }

	inline dBodyID				GetBody()		{ return (m_pRigidBody); }
	inline dBodyID const		GetBody() const	{ return (m_pRigidBody); }

	inline void					SetEntity(GameObject* pEntity) { m_pEntity = pEntity; }
	inline GameObject*			GetEntity()			{ return (m_pEntity); }
	inline GameObject const*	GetEntity() const	{ return (m_pEntity); }

	void		SyncWithEntity		();
	void		SyncEntity			();

	float		GetFriction			() const;
	void		SetFriction			(float friction);
	void		SetLinearVelocity	(const Vec3& vel);
	Vec3		GetLinearVelocity	() const;

	void		SetGravity			(const Vec3& gravityVector);
	Vec3		GetGravity			();

private:
	GameObject*			m_pEntity;
	dTriMeshDataID		m_pTriMesh;
	dGeomID				m_pCollisionShape;
	dBodyID				m_pRigidBody;

	float				m_Friction;
	Vec3				m_Gravity;
	
	Vec3				m_LinearVelocity;
};

#endif // !PHYSICS_OBJECT_H
