Collision Groups with Actors.

ShUr1k3n

19-12-2009 16:51:33

How can i define collision groups with Actors?

I tried to use something like this:


...
mBall = mRenderSystem->createBody(NxOgre::SphereDescription(1.75f) , NxOgre::Vec3(0,200, 0), "ball.mesh");
mBall->setGroup(0);

mBall2 = mRenderSystem->createBody(NxOgre::SphereDescription(1.75f) , NxOgre::Vec3(0,200, 0), "ball.mesh");
mBall2->setGroup(1);
...


But they still collide, then i tried this code:


mScene->getScene()->setGroupCollisionFlag(0,1,false);


And they collide again :S

What do i need to do more, to make this working?

Thanks.

LucaMoller

19-12-2009 17:09:09

I have done it this way in NxOgre 1.0.22 : (it may be similar in Bloody Mess)

body1 = sys::mNxScene->createBody( "body1" , new NxOgre::Capsule(18,5), pos , "" ,"mass:100");
NxShape* const* s = body1->getNxActor()->getShapes();
(*s)->setGroup(1);

body2 = sys::mNxScene->createBody( "body2" , new NxOgre::Capsule(18,5), pos , "" ,"mass:100");
NxShape* const* s2 = body2->getNxActor()->getShapes();
(*s2)->setGroup(2);


And then: (This Group Collision Flag is for Shape Groups, not for Actor Groups)

mNxScene->getNxScene()->setGroupCollisionFlag(1 , 2 , false);


Hope this helps :wink:

ShUr1k3n

19-12-2009 17:18:17

Worked like a charm! Thanks a lot! :)