Caphalor
09-03-2007 18:02:02
Hi, because it's very uncomfortable to link every body via scene::createContactPair with the other bodies, I looked for a better way and I found createStateContactPair. But the function is empty...
Is there another way or must I write this function?
betajaen
09-03-2007 20:00:17
It seems it is. I must of forgot to write it.
The state contact pair would be exactly the same as loop full of createContactPair's, more so as it'd have to check all bodies with specific states.
Caphalor
09-03-2007 21:14:59
Ok. I wrote the function:
// Iterate all through bodies with a state of a, and link them up
// with a state of b.
void scene::createStateContactPair(stateType a, stateType b, bool _both)
{
for (std::map< Ogre::String, nxOgre::body* >::iterator i = mBodies.mCollection.begin();i != mBodies.mCollection.end();++i)
{
if (i->second->isUnderState(a) == true)
{
for (std::map< Ogre::String, nxOgre::body* >::iterator x = mBodies.mCollection.begin();x != mBodies.mCollection.end();++x)
{
if (x->second->isUnderState(b) == true)
{
createContactPair(i->second,x->second);
}
}
}
}
}
It seems to work, now I can continue programming my SpellManager class.
What's the use of the _both parameter?
betajaen
09-03-2007 21:37:45
So you can have both contact pairs a <--> b, instead of a -> b. You have the latter in your case.
betajaen
09-03-2007 22:38:35
Not anymore
I'll add it to the SVN if you like.