#ifndef CPHYSICS_RAGDOLL_H
#define CPHYSICS_RAGDOLL_H

#include "PhysicsGlobal.h"
#include "SPhysicsStructs.h"
#include "MPhysicsCallbacks.h"
#include "IPhysicsBaseEntity.h"

class IPhysicsRagdoll
{
public:
	IPhysicsRagdoll();
	~IPhysicsRagdoll();
	void init(NewtonWorld* world, IrrlichtDevice* dev, SPhysicsRagdoll* doll);

private:
	NewtonWorld* m_world;
	IrrlichtDevice* m_device;

	NewtonRagDoll* m_ragdoll;

	list<IPhysicsBaseEntity*> m_partsList;

	void buildRagDoll(NewtonRagDoll* ragDoll, NewtonRagDollBone* parentDollBone, ISceneNode* bone, int id);

	static void _cdecl setRagDollTransform (const NewtonRagDollBone* bone);
	static void _cdecl applyRagDollForceAndTorqueEvent (const NewtonBody* body);
};

#endif