Convex hulls

slinky

25-04-2007 16:50:02

Are the any examples using convex hulls for collision. The ogrenewt examples seem to just use the primitives.

Drakon

25-04-2007 17:53:05

You can create convex collision like that :

Ogre::Real mass = 100;
//create body
OgreNewt::ConvexCollision* col = new OgreNewt::CollisionPrimitives::ConvexHull(nWorld,SceneNode);
OgreNewt::Body* bod = new OgreNewt::Body(nWorld, col );
Ogre::Vector3 inertia,ofset;
col->calculateInertialMatrix(inertia,ofset);
delete col;
//attach to node
bod->attachToNode(SceneNode);
//set inertia
bod->setMassMatrix(mass,inertia);
//mass center
bod->setCenterOfMass(Ogre::Vector3(ofset.x,ofset.y,ofset.z));
//set calback
bod->setStandardForceCallback();

slinky

25-04-2007 18:04:24

Thanks for the reply. How would i be able to create vertex hulls around a mesh? To i have to put the vertices in manually from the mesh?

Vectrex

26-04-2007 06:34:07

Thanks for the reply. How would i be able to create vertex hulls around a mesh? To i have to put the vertices in manually from the mesh?

nah it's all automatic, just pass a scenenode with the mesh attached