Weird issue with NewtonJointSetUserData()

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Weird issue with NewtonJointSetUserData()

Postby kallaspriit » Sun Nov 22, 2009 3:25 pm

I discovered OgreNewt built-in joints have stopped working - it's just like it's not there. Tried creating a joint manually using the NewtonConstraintCreateHinge() methods and it worked. Investigated and found that when I comment out NewtonJointSetUserData() call, the OgreNewt joint works:

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 :D
kallaspriit
 
Posts: 216
Joined: Sun Aug 14, 2005 6:31 pm

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 6 guests