Moderators: Sascha Willems, walaber
class _OgreNewtExport KinematicController : public Joint
{
public:
KinematicController::KinematicController(OgreNewt::Body* bdy0, const Ogre::Vector3& pos);
KinematicController::~KinematicController();
void KinematicController::setPickMode(int mode);
void KinematicController::setMaxLinearFriction(float accel);
void KinematicController::setMaxAngularFriction(float alpha);
void KinematicController::setTargetRotation(const Ogre::Quaternion& rot);
void KinematicController::setTargetPosit(const Ogre::Vector3& pos);
};
KinematicController::KinematicController(OgreNewt::Body* bdy0, const Ogre::Vector3& pos)
:Joint()
{
//OgreNewt::Body::
CustomKinematicController* ckc = new CustomKinematicController(bdy0->getNewtonBody(),dVector(pos.x,pos.y,pos.z));
SetSupportJoint(ckc);
}
KinematicController::~KinematicController(){}
void KinematicController::setPickMode(int mode)
{
CustomKinematicController* ckc = (CustomKinematicController*)m_joint;
ckc->SetPickMode(mode);
}
void KinematicController::setMaxLinearFriction(float accel)
{
CustomKinematicController* ckc = (CustomKinematicController*)m_joint;
ckc->SetMaxLinearFriction(accel);
}
void KinematicController::setMaxAngularFriction(float alpha)
{
CustomKinematicController* ckc = (CustomKinematicController*)m_joint;
ckc->SetMaxAngularFriction(alpha);
}
void KinematicController::setTargetRotation(const Ogre::Quaternion& rot)
{
CustomKinematicController* ckc = (CustomKinematicController*)m_joint;
ckc->SetTargetRotation(dQuaternion(rot.x,rot.y,rot.z,rot.w));
}
void KinematicController::setTargetPosit(const Ogre::Vector3& pos)
{
CustomKinematicController* ckc = (CustomKinematicController*)m_joint;
ckc->SetTargetRotation(dVector(pos.x,pos.y,pos.z));
}
//Dont look at this is just some internal creation calls of my game engine.
SceneGeometryManager::getSingleton().CreateMesh("player_2",&tmplt,pos+Ogre::Vector3(0,0,5),Ogre::Quaternion::IDENTITY,Ogre::Vector3(1,1,1));
PhysicObject* po2 = ObjectManager::getSingleton().createBody("player_2",false,Ogre::Vector3::ZERO,2400,false);
//////////////////////////////////
// Mass of object is 2400kg and gravitation accel is 9.8m/s^2
kc = new OgreNewt::KinematicController(po2->getOgreNewtBody(),pos+Ogre::Vector3(0,1,5));
kc->setMaxLinearFriction(200);
kc->setMaxAngularFriction(800);
kc->setTargetRotation(Ogre::Quaternion::IDENTITY);
kc->setTargetPosit(Ogre::Vector3(0,10,0));
//kc->setPickMode(1);
// Mass of object is 2400kg and gravitation accel is 9.8m/s^2
kc = new OgreNewt::KinematicController(po2->getOgreNewtBody(),pos+Ogre::Vector3(0,1,5));
kc->setMaxLinearFriction(200);
kc->setMaxAngularFriction(800);
Users browsing this forum: No registered users and 1 guest