[NxOgre 0.9]Multiple actor groups problem

Kwazar

30-06-2008 20:51:40

Hi!
I have a strange problem when I'm using multiple actor groups.

I have got 3 actor groups in my game:

AGGrass
AGBall
AGStone


I have created 2 collision callbacks:

Core::PhysXEngine::Get()->GetScene()->getActorGroup( "AGGrass" )->setCollisionCallback( Core::PhysXEngine::Get()->GetScene()->getActorGroup( "AGBall" ), NX_NOTIFY_ON_START_TOUCH, false );
Core::PhysXEngine::Get()->GetScene()->getActorGroup( "AGGrass" )->setCallback<SB::Lvl::Tropic::Sounds::Functions>( new SB::Lvl::Tropic::Sounds::Functions,
&SB::Lvl::Tropic::Sounds::Functions::BallGrass,
NULL,
NULL );


And:


Core::PhysXEngine::Get()->GetScene()->getActorGroup( "AGGrass" )->setCollisionCallback( Core::PhysXEngine::Get()->GetScene()->getActorGroup( "AGStone" ), NX_NOTIFY_ON_START_TOUCH, false );
Core::PhysXEngine::Get()->GetScene()->getActorGroup( "AGGrass" )->setCallback<SB::Lvl::Tropic::Sounds::Functions>( new SB::Lvl::Tropic::Sounds::Functions,
&SB::Lvl::Tropic::Sounds::Functions::GrassStone,
NULL,
NULL );


The problem is that when group "AGGrass" is colliding with actor group "AGBall" doesn't run function:


SB::Lvl::Tropic::Sounds::Functions::BallGrass

but

SB::Lvl::Tropic::Sounds::Functions::GrassStone


There is no problem when group "AGGrass" is colliding with actor group "AGStone"

When I change turn of defining collision callbacks are inversely.
The problem is appearing only when two collision callbacks have the same actor groups ( in this case "AGGrass" )

I tried yesterday use NxOgre Bleeding in my game but method of rendering Ogre entities was changed since version 0.9 and my game is too expanded to rewrite code.

Sorry about my english it isn't my national language.

Can somebody help?

Gohla

01-07-2008 10:45:52

I think setCollisionCallback and setCallback override the current settings, so you can only have one CollisionCallback per group?

Kwazar

03-07-2008 21:01:00

I have solved the problem :)

AG1->setCollisionCallback( AG2, NX_NOTIFY_ALL, false );
AG1->setCallback<CallBack>( newCallBack, CallBack::onStartTouch, CallBack::onEndTouch, CallBack::Jiggle );
AG1->setCollisionCallback( AG3, NX_NOTIFY_ALL, false );
AG1->setCollisionCallback( AG4, NX_NOTIFY_ALL, false );
.
.
.
AG1->setCollisionCallback( AG10000, NX_NOTIFY_ALL, false );

void CallBack::onStartTouch( NxOgre::Actor *A, NxOgre::Actor *B )
{
if( B->getGroup()->getName() == AG2->getGroup()->getName() )
{
//Do something
}
else if( B->getGroup()->getName() == AG3->getGroup()->getName() )
{
//Do something
}

.
.
.
else if( B->getGroup()->getName() == AG10000->getGroup()->getName() )
{
//Do something
}
}