patie
13-04-2007 07:00:02
i'm trying to make a universal joint that is atached as a child to a body attached by a slider to the body of a Simplecar. the slider works properly. the universal joint is attached at the right position to the sliding body.
What is not right, is that the calculateStopAlpha() and setCallbackAccel() function called in the custom callback used by my UniversalJoint derived class don't seems to have no effect. The body attached by the universal joint is spinning around axes it should not.
Is there something missing in my doing?
the callback
the class constructor
the parameters
What is not right, is that the calculateStopAlpha() and setCallbackAccel() function called in the custom callback used by my UniversalJoint derived class don't seems to have no effect. The body attached by the universal joint is spinning around axes it should not.
Is there something missing in my doing?
the callback
static void UniversalCallBack(OgreNewt::BasicJoints::Universal* uni)
{
Ogre::Radian angle0 = uni->getJointAngle0();
Ogre::Radian angle1 = uni->getJointAngle1();
Ogre::Real accel;
if(angle0.valueDegrees()>Ogre::Real(10))
{
accel = uni->calculateStopAlpha0(angle0.valueDegrees());
uni->setCallbackAccel(accel,0);
}
if(angle0.valueDegrees()<Ogre::Real(-10))
{
accel = uni->calculateStopAlpha0(angle0.valueDegrees());
uni->setCallbackAccel(accel,0);
}
if(angle1.valueDegrees()>Ogre::Real(10))
{
accel = uni->calculateStopAlpha1(angle1.valueDegrees());
uni->setCallbackAccel(accel,1);
}
if(angle1.valueDegrees()<Ogre::Real(-10))
{
accel = uni->calculateStopAlpha1(angle1.valueDegrees());
uni->setCallbackAccel(accel,1);
}
};the class constructor
PatiUniversal::PatiUniversal(OgreNewt::World* monde, OgreNewt::Body* child, OgreNewt::Body* parent, Ogre::Vector3 point,Ogre::Vector3 pin,Ogre::Vector3 pin2)
: OgreNewt::BasicJoints::Universal(monde,child,parent,point,pin,pin2)
{
m_parent = parent;
m_child = child;
setCallback(UniversalCallBack);
}the parameters
bearing = new PatiUniversal(mWorld,DiscBearing,shaft,m_Position,Ogre::Vector3(1,0,0),Ogre::Vector3(0,1,0));