- Code: Select all
Hinge::Hinge( const World* world, const OgreNewt::Body* child, const OgreNewt::Body* parent, const Ogre::Vector3& pos, const Ogre::Vector3& pin ) : Joint()
{
m_world = world;
if (parent)
{
m_joint = NewtonConstraintCreateHinge( world->getNewtonWorld(), &pos.x, &pin.x,
child->getNewtonBody(), parent->getNewtonBody() );
}
else
{
m_joint = NewtonConstraintCreateHinge( world->getNewtonWorld(), &pos.x, &pin.x,
child->getNewtonBody(), NULL );
}
//NewtonJointSetUserData( m_joint, this ); // uncommenting this again breaks the joint, works with this commented out
NewtonJointSetDestructor( m_joint, destructor );
//NewtonHingeSetUserCallback( m_joint, newtonCallback );
m_callback = NULL;
}
If I added the NewtonJointSetUserData() in my manual code, it still worked. I can't imagine why setting the user data to OgreNewt joint container breaks the joint, any ideas? Or am I missing something obvious