lost traction in UserCallback...

me_go_fast

21-05-2006 18:43:14

Hello, I was wondering if someone could explain to me how to use the losttraction function of the vehicle joint, so that I can make the tires smoke when the tire/tires lose traction. I tried putting the following code in the user callback, but was unsuccessful.

if ( cTire->lostTraction )
{
Ogre::ParticleSystem* tireSmokeParticle = Ogre::ParticleSystemManager::getSingleton().createSystem("TireSmokeSys","Car/TireSmoke");
Ogre::SceneNode* tireSmokeNode = sceneMgr->getRootSceneNode()->createChildSceneNode("TireSmokeSceneNode");
tireSmokeNode->attachObject(tireSmokeParticle);
Ogre::Vector3 pos;
Ogre::Quaternion orient;
cTire->getPositionOrientation(orient,pos);
tireSmokeNode->setPosition(Ogre::Vector3(0,1,0));
}


When I compile, I get an error:

error C3867: 'OgreNewt::Vehicle::Tire::lostTraction': function call missing argument list; use '&OgreNewt::Vehicle::Tire::lostTraction' to create a pointer to member

It makes sense in a way because I originally thought that lostTraction returned a boolean, but it returns an int. But I am not sure what the int is returns is and what I need to compare it to in order to tell if the tire has lost traction or not. Thanks for help!

danharibo

21-05-2006 18:55:27

maybe a binary int? like 1/0

walaber

21-05-2006 20:32:47

change
if ( cTire->lostTraction )

to


if ( cTire->lostTraction() )

me_go_fast

22-05-2006 04:35:03

Hey, thanks, that did the trick! :D