2011-02-22 13:02:50 +00:00
|
|
|
#include "CMotionState.h"
|
|
|
|
#include "physic.hpp"
|
|
|
|
|
|
|
|
#include <btBulletDynamicsCommon.h>
|
|
|
|
#include <btBulletCollisionCommon.h>
|
2013-02-24 21:52:23 +00:00
|
|
|
#include <components/nifbullet/bulletnifloader.hpp>
|
2011-02-22 13:02:50 +00:00
|
|
|
|
|
|
|
namespace OEngine {
|
|
|
|
namespace Physic
|
|
|
|
{
|
|
|
|
|
2011-04-03 11:12:12 +00:00
|
|
|
CMotionState::CMotionState(PhysicEngine* eng,std::string name)
|
2012-06-06 18:29:30 +00:00
|
|
|
: isPC(false)
|
|
|
|
, isNPC(true)
|
2011-04-03 11:12:12 +00:00
|
|
|
{
|
|
|
|
pEng = eng;
|
|
|
|
tr.setIdentity();
|
|
|
|
pName = name;
|
2012-10-09 15:10:25 +00:00
|
|
|
}
|
2011-04-03 11:12:12 +00:00
|
|
|
|
|
|
|
void CMotionState::getWorldTransform(btTransform &worldTrans) const
|
|
|
|
{
|
|
|
|
worldTrans = tr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMotionState::setWorldTransform(const btTransform &worldTrans)
|
|
|
|
{
|
|
|
|
tr = worldTrans;
|
|
|
|
|
|
|
|
PhysicEvent evt;
|
|
|
|
evt.isNPC = isNPC;
|
|
|
|
evt.isPC = isPC;
|
|
|
|
evt.newTransform = tr;
|
|
|
|
evt.RigidBodyName = pName;
|
|
|
|
|
|
|
|
if(isPC)
|
|
|
|
{
|
|
|
|
pEng->PEventList.push_back(evt);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pEng->NPEventList.push_back(evt);
|
|
|
|
}
|
|
|
|
}
|
2011-02-22 13:02:50 +00:00
|
|
|
|
2011-02-26 15:34:43 +00:00
|
|
|
}}
|