problem with BasicJoints::Hinge in OgreNewt

pawka

28-05-2008 16:42:58

Hi, I've changed second demo of OgreNewt (Demo02_Joints). This is that change:


if (parent)
{
//joint = new OgreNewt::BasicJoints::BallAndSocket( m_World, child, parent, pos-Ogre::Vector3(size.x/2,0,0) );
joint = new OgreNewt::BasicJoints::Hinge( m_World, child, parent, pos-Ogre::Vector3(size.x/2,0,0), pos-Ogre::Vector3(0,0,1) );
}
else
{
// no parent, this is the first joint, so just pass NULL as the parent, to stick it to the "world"
//joint = new OgreNewt::BasicJoints::BallAndSocket( m_World, child, NULL, pos-Ogre::Vector3(size.x/2, 0, 0) );
joint = new OgreNewt::BasicJoints::Hinge( m_World, child, NULL, pos-Ogre::Vector3(size.x/2,0,0), pos-Ogre::Vector3(0,0,1) );
}


As you can see i've changed only type of joints (from OgreNewt::BasicJoints::BallAndSocket to OgreNewt::BasicJoints::Hinge) but only first joint works as hinge, other work like they were ballAndSocket:( Does anyone know what's going on??

jerryg

28-07-2008 12:06:57

I think you need to remove the "pos-" from the final argument to the constructors. The pin direction is being set to the vector you're after, but offset by the position of this segment of rope, which is probably ending up with a pretty unexpected vector.