Coiote
28-05-2008 17:55:19
Hey
I'm implementing callback's im my app. I try it first in Cake, and it works splendid, just the away I wanted for my game. So, as happy I can be, I start implementing the callback in my app. For my disappointing the callback on my app doesn't do anything. It supposed to when the cube that is in Ship Group fall down on the cube of PowerUp, the cube on Ship, change is aspect and the PowerUp be destroyed.
Here's the code:
My callback is:
Thankx
I'm implementing callback's im my app. I try it first in Cake, and it works splendid, just the away I wanted for my game. So, as happy I can be, I start implementing the callback in my app. For my disappointing the callback on my app doesn't do anything. It supposed to when the cube that is in Ship Group fall down on the cube of PowerUp, the cube on Ship, change is aspect and the PowerUp be destroyed.
Here's the code:
CallbackManager *mCallback = new CallbackManager();
mShipGroup = mScene->createActorGroup("Ship");
mPowerUpGroup= mScene->createActorGroup("PowerUp");
/*Objects*/
mScene->createBody("cube.1m.mesh", new CubeShape(1,1,1), Vector3(5,100,-25), "mass: 100 Group: Ship");
mScene->createBody("cube.1m.mesh", new CubeShape(1,1,1), Vector3(5,25,-25), "mass: 100 Group: PowerUp");
mShipGroup->setCallback(mCallback);
mShipGroup->setCollisionCallback(mPowerUpGroup, NX_NOTIFY_ALL, true);
mShipGroup->setCallback<CallbackManager>(mCallback, &CallbackManager::aLive, &CallbackManager::TurnRed, &CallbackManager::Kill);
My callback is:
class CallbackManager : public NxOgre::GroupCallback::InheritedCallback
{
void onStartTouch(NxOgre::Actor*, NxOgre::Actor*);
void onEndTouch(NxOgre::Actor*, NxOgre::Actor*);
void onTouch(NxOgre::Actor*, NxOgre::Actor*);
public :
CallbackManager();
~CallbackManager();
void TurnRed(NxOgre::Actor* a , NxOgre::Actor* b);
void TurnYellow(NxOgre::Actor* a, NxOgre::Actor* b);
void TurnXPTO(NxOgre::Actor* a, NxOgre::Actor* b);
void Kill(NxOgre::Actor* a, NxOgre::Actor* b);
void aLive(NxOgre::Actor* a, NxOgre::Actor* b);
void Jiggle(NxOgre::Actor* a, NxOgre::Actor* b);
};
Thankx