how to automatically create simple bounding box shape?

Arcanor

18-02-2008 17:47:25

When I call createBody() it requires a ShapeBlueprint*. How can I tell NxOgre to just use an approximation such as an axis-aligned bounding box, without sending in a specific blueprint?

SiWi

18-02-2008 19:01:46

Please read:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=6454

Especially the shortguide.

Arcanor

18-02-2008 19:16:50

Sorry, but this is a frustrating answer as I've already read the short guide completely (twice!) and have been spending lots of time (i.e. several days of time) reading through all the forum posts, including the one you mention, and its links, plus the sources for NxOgre and Cake, plus I've compiled the Doxygen documentation from the source code as well.

Specifically, in the short guide it says "More on shapes will be explained in the next chapter" while in chapter 4, however there is no chapter 5 written yet. I want to know what sort of shape choices are appropriate for different situations, and how to create those shapes efficiently.

I fully understand how Cake uses the NxOgre::CubeShape() to make various sizes of boxes manually. However I'm looking for a way to automatically create such a box efficiently, based on the mesh, and not have to specifically define the size. I probably should have made this more clear in my original post, sorry!

I also already understand how I can use a NxOgre::TriangleMeshShape() to do what I want. However I don't think I need the complexity of a triangle mesh shape for most objects. A simple axis-aligned box would do fine.

Is there a way to find this easily?

Thanks.

betajaen

18-02-2008 19:23:21

There isn't a way to do it automatically in NxOgre as no such code exists. If you want to write one in a function it would be six lines tops.

In short:

- Make a scenenode, entity.
- Use Ogre to tell you the AABB stuff.
- Create a cubeShape with the aabb max/min as the shape dimensions.
- Create a new actor/body using the node you have created. Pass on orientation/position as pose to the actor.
- Profit.

Arcanor

18-02-2008 19:26:36

Okay, thanks betajaen. I was previously creating my own Ogre::Entity when I was using OgreNewt, but now that I'm converting to NxOgre I noticed that your createBody() function is already creating the Ogre::Entity, so I took my entity creation code out.

I guess I will add it back in and then pass that into my function which calls createBody(), along with a CubeShape created with the Ogre::Entity's AAB info.