abecam
19-05-2006 16:15:53
Hello everyone!
I advance quite well doing my first game using Ogre and ONewt , then I have two questions . The first one because I did something wrong but I have no idea what... I use a ball & socket joint between a container and a handler, apply just gravity, the "handler" is stuck by a 2D joint:
Then it was working well, but now the handler turn like crazy. That's funny but not intented. And before I apply any translation force on it (only gravity). Any idea of my stupid mistake ? Here is my code:
UPDATE: I still have my crazy "handler", and I know it is a problem linked with the 2D joint (because it doesn't turn without the joint). The grey and white box is supposed to just "hang" quietly, and the ellipsoid is not supposed to turn at all...
Strangely it disappeared when I included the shadow information in my dotScene loader, and appeared again when I included my material infos (for the collision callbacks I use for my score, that works perfectly).
For the containing box problem (my rigid bodies didn't want to appear inside the box), it is fixed... I supposed I fixed it by trying to fix the crazy joint problem...
If someone knows, is this possible that my BallAndSocket joint is not at the right position compared to the 2D one??? A kind of conflict? (then I never changed this part of the code, and it worked before).
I tried also to give a constraint and to reset the angle, but it doesn't help that much... Anyway it is funny as it is , but not very usable for my game
I advance quite well doing my first game using Ogre and ONewt , then I have two questions . The first one because I did something wrong but I have no idea what... I use a ball & socket joint between a container and a handler, apply just gravity, the "handler" is stuck by a 2D joint:
----------------------Handler ellipsoid-------------------- 2D joint
|
| Ball& Socket joint
Container
Then it was working well, but now the handler turn like crazy. That's funny but not intented. And before I apply any translation force on it (only gravity). Any idea of my stupid mistake ? Here is my code:
OgreNewt::Body * container = makeSimpleBox(Ogre::Vector3(0.5,2,0.5), Ogre::Vector3(0,40,0), Ogre::Quaternion(Ogre::Quaternion::IDENTITY));
Ogre::Quaternion orientHandle ( Ogre::Vector3(0,0,0),Ogre::Vector3(0,1,0),Ogre::Vector3(0,0,0) );
handleBox = makeSimpleEll(Ogre::Vector3(0.5,1,0.5), Ogre::Vector3(0,42.5,0),orientHandle);
// Set the force to translate the handler to (0,0,0)
mesInteractions.setForceTrans(Ogre::Vector3(0,0,0));
handleBox->setUserData(&mesInteractions);
LogManager::getSingleton().logMessage(" Set the custom callback ");
handleBox->setCustomForceAndTorqueCallback(userForceCallback);
handleBox->setAutoFreeze(0);
container->setAutoFreeze(0);
container->setCustomForceAndTorqueCallback(userForceCallbackCont);
LogManager::getSingleton().logMessage(" To the joint ");
joint2= new OgreNewt::PrebuiltCustomJoints::Custom2DJoint(handleBox,Ogre::Vector3(0,2,0));
jointBS= new OgreNewt::BasicJoints::BallAndSocket( m_World, container, handleBox, Ogre::Vector3(0,40,0)+Ogre::Vector3(0,2,0) );
jointBS->setLimits (Ogre::Vector3(0,2,0), Ogre::Radian(0.8), Ogre::Radian(0.1));
UPDATE: I still have my crazy "handler", and I know it is a problem linked with the 2D joint (because it doesn't turn without the joint). The grey and white box is supposed to just "hang" quietly, and the ellipsoid is not supposed to turn at all...
Strangely it disappeared when I included the shadow information in my dotScene loader, and appeared again when I included my material infos (for the collision callbacks I use for my score, that works perfectly).
For the containing box problem (my rigid bodies didn't want to appear inside the box), it is fixed... I supposed I fixed it by trying to fix the crazy joint problem...
If someone knows, is this possible that my BallAndSocket joint is not at the right position compared to the 2D one??? A kind of conflict? (then I never changed this part of the code, and it worked before).
I tried also to give a constraint and to reset the angle, but it doesn't help that much... Anyway it is funny as it is , but not very usable for my game