Callback for any collision

shanefarris

22-04-2011 18:41:18

I have a ragdoll I am working with and need to have a report if anything hits it, specifically raycast to start with. I was that in the wrapper we need to specify which bodies will collide with other bodies that have a custom callback is that correct?

mBodyA = makeBox(Vec3(0,3,0));
mBodyA->setContactCallback(this);

mBodyB = makeBox(Vec3(0,7,0));
mBodyB->setContactCallback(this);

mScene->setActorFlags(mBodyA, mBodyB, NxOgre::Enums::ContactPairFlags_All);



Is there a way to create a custom callback and have it be called if anything collides with it? Example, I create a raycast with 50 ragdolls in the scene, how do I create a callback that will handle any raycast hitting any actor in any ragdoll per frame?

Thanks.

betajaen

22-04-2011 19:15:25

I think you can do it with Actor or Shape groups.

shanefarris

22-04-2011 19:46:09

I thought groups where used to filter results. I don't understand how I can use groups to help with this problem, can you be more specific?

Thanks.

betajaen

22-04-2011 21:02:34

There is Group v.s. Group collision callbacks.

If you want your object to report collisions with anything, there are two possible ways;

- Manually create events with all objects in the scene (and future ones) in a big loop.
- Place your actor in one group, and the objects in different groups, then use group v.s. group collisions to simplify it. (in a smaller loop).

shanefarris

22-04-2011 21:05:22

Makes sense, and this is done by setting the "actor group"?

betajaen

22-04-2011 21:08:10

Yes; or shape groups. Which may be better for you - or not.

It's all in the PhysX documentation chm, and all the classes and method names are exactly the same in NxOgre (minus the Nx prefix).