ConvexShape or TriangleMeshShape from vertice list

moagames

13-04-2008 18:05:42

Hi,

I need to make a Convex mesh from a list of vertices.
Is there any way to make this ?
Is there any way to make it at least with a TriangleMeshShape ?

Thank you very much

betajaen

13-04-2008 18:07:52

ManualMesh?

moagames

13-04-2008 18:12:02

thanx for the fast reply, but i don't meen the Ogre stuff, but the physics stuff, so if i have 8 points of a box and want to make a physics object of that.
How can i do that ?

betajaen

13-04-2008 18:44:49

No. It's an NxOgre class ManualMesh.

http://www.nxogre.org/How_to_build_a_Co ... _from_code

moagames

13-04-2008 18:59:15

That sounds very interesting, but i am still using 0.9 becaus i need characters.

So is there any way to make something similiar with 0.9 ??

thank you very much for your support

betajaen

13-04-2008 19:13:15

No, it is not possible.

NickM

13-04-2008 21:05:28

I'm sure in the past I've done this?
Is this something like what you want...

NxConvexMeshDesc convexDesc;
convexDesc.numVertices = metalBody->metalMeshVertexCount;
convexDesc.pointStrideBytes = sizeof(NxVec3);
convexDesc.points = collisionShapeVerts;
convexDesc.flags = NX_CF_COMPUTE_CONVEX;//, NX_SF_POINT_CONTACT_FORCE;

static NxCookingInterface *gCooking = NxGetCookingLib(NX_PHYSICS_SDK_VERSION);

//Make sure to initialize the cooking library.
gCooking->NxInitCooking();

NxOgre::NxString filename;
filename = modelOfCar + "collision_model.nxs";

UserStream buf(filename.c_str(),false);
bool status = NxCookConvexMesh(convexDesc, buf);
if(!status){
GameManager::getSingletonPtr()->throwErrorMessage(filename + "failed to cook properly");
}

fclose(buf.fp);

convex = new NxOgre::ConvexShape(filename, "material: CarBodyMaterial");

betajaen

13-04-2008 21:22:00

Well yes, you can do that. But ManualMesh is much easier and more "NxOgrey" than that PhysX code there.