atsakir
22-03-2006 16:52:37
I have billboarded grass and I want to affect the velocity of my character when he passes through the bounding volume of the grass.
I have asked about this before and was prompted by walaber to setup a collision callback. I used Tutorial3 as a guide and set up the following userProcess in which I always return 0 (reject the collision) and cut the velocity to half. However, the collision still bounces my character against the bounding volume of the grass instead of passing through with half the velocity. What am I doing wrong? Should I override the contactProcess instead of the userProcess?
I have asked about this before and was prompted by walaber to setup a collision callback. I used Tutorial3 as a guide and set up the following userProcess in which I always return 0 (reject the collision) and cut the velocity to half. However, the collision still bounces my character against the bounding volume of the grass instead of passing through with half the velocity. What am I doing wrong? Should I override the contactProcess instead of the userProcess?
int grassMatCallback::userProcess()
{
OgreNewt::Body* grass;
OgreNewt::Body* object;
if (m_body0->getType() == mGrassID)
{
Ogre::LogManager::getSingleton().logMessage(" COLLISION 0");
grass = m_body0;
object = m_body1;
}
if (m_body1->getType() == mGrassID)
{
Ogre::LogManager::getSingleton().logMessage(" COLLISION 1");
grass = m_body1;
object = m_body0;
}
if (!grass) {
Ogre::LogManager::getSingleton().logMessage(" NO COLLISION ");
}
object->setVelocity(object->getVelocity()*0.5);
return 0;
}