int SoundTriggerCallback::userBegin()
{ //myNamespace::writeF("soundtriggerhit.log","hit trigger me");
if(this->m_body1->getType() == 1)
{
myNamespace::writeF("soundtriggerhit.log","hit trigger 1");
PlayState::getInstance()->hit = true;
PlayState::getInstance()->TonalChanger(1);
}
//PlayState::getInstance()->pause();
//PlayState::reset();
return 0;
}
im using this callback, so that when a player walks threw this mesh. which is a box, with convexhull on it, would set off a flag that would allow me to do whatever i want with it. but the problem is, everytime i walk threw it, it gets called like 10 times or more. im using return 0; to ignore the collision so i can walk threw it. but i don't understand why it gets called so many times for one contact. any ideas?
CagedFury
28-03-2007 20:57:12
Im not 100% but does it get called while there is contact between the meshs rather than just at first contact.
So if you are walking into the mesh and there is contact for 10 physics frames then it will be called 10 times?
Im sure you could get it to be called more times if Continuous collision mode was on. But to get to be called only once i dont know.
Perhaps setup a time delay until the action it performs is performed again, or set a boolean value so that it will only be triggered once, depending on what way you want it to work.
nikhil
03-04-2007 13:41:36
yup thats how it works.. every frame it's a new collision for the physics engine.. so you'll have to use flags and stuff to take care of the FIRST instance of the collision detection.. what's annoying is that there's no function to pool when they are not touching.. otherwise when they first touch u set a flag and then just reset it in the noCollision function..