How to link NxOgre::RigidBody and NxOgre::Volume together?

dronbas

06-04-2011 15:31:03

Hello!
I have a body (Critter::Body) and a volume (NxOgre::Volume). I thought I could use a fixed joint to link them together, but got and error due to NxOgre::Volume not beeing a dynamic actor. How can I link them together?

Thank you.

betajaen

06-04-2011 15:53:48

You can't. At least not in NxOgre.

The nearest thing I can think of, is turning off the move flags for the Body, and so it sticks to the same spot within the Volume.

dronbas

06-04-2011 16:22:24

Does it mean that I can't create a moving Volume?
I'm looking at PhysX sample about triggers. And it seems that a 'dynamic trigger' can be what I am looking for.

betajaen

06-04-2011 17:02:21

No, not in the current NxOgre unfortunately.

I have some ideas on how to address this in LeJean, but that is a while off.

You can mix PhysX code with NxOgre though, if you want to set the appropriate shape flag. Callbacks will be a little difficult, you'd have to somehow get your own working, since NxOgre expects the parent NxOgre class of a Shape with a trigger flag to be a volume.


Can I ask what your trying to do? Perhaps there is an alternative way.

dronbas

06-04-2011 17:13:01

I want to do the following. I have an object bowl. It has one .mesh and several convex .nxs meshes. I create it using Critter::RenderSystem::createBody.
I want to be able to find what objects (Critter::Body) are in the bowl. I suppose there are several ways to do it:
1. Use collision detection. Objects in the bowl touch only the bowl and themselves. This is not good because the bowl can be rotated upside down.
2. Create an actor with shape, representing a volume in and above the bowl. Use fixed joint to link the bowl and that actor. Disable response for the actor. And seek collisions with it.
3. Try to use native PhysX code.
Your ideas?

betajaen

06-04-2011 17:16:26

You can use an intersection (bit like a 3D raycast).

Scene::overlapSphereShape

[Edit]

To be more accurate. You can use the intersection to check what objects are in the bowl, using a bit of math trickery to just count for the shapes within the bowl via the bottom hemisphere.

dronbas

06-04-2011 20:07:56

Thank you for the consultation.
Another way that I've tried - every frame use Volume::setGlobalPose(Body::getGlobalPose()) to synchronize the movement of the bowl and the volume. And it seems to work.