create a mesh shape from data

Grom

13-02-2007 13:44:33

I've been pouring over the NxOgre code looking for a method to create a meshShape from vertex data. I've had a look at the heightfieldShape stuff, and it looks good, but I really want to create a shape from my own data, using NxActorDescs and NxTriangleMeshShapeDescs.

I've boiled it down to this:

NxTriangleMeshDesc mTriangleMeshDescription;
mTriangleMeshDescription.numVertices = (*numVtx);
mTriangleMeshDescription.numTriangles = indexData->indexCount / 3;
mTriangleMeshDescription.pointStrideBytes = sizeof(NxVec3);
mTriangleMeshDescription.triangleStrideBytes = 3 * sizeof(NxU32);
mTriangleMeshDescription.points = mMeshVertices;
mTriangleMeshDescription.flags = NX_MF_HARDWARE_MESH;
mTriangleMeshDescription.triangles = mMeshFaces;
mTriangleMeshDescription.materialIndexStride = sizeof(NxMaterialIndex);
mTriangleMeshDescription.materialIndices = mMaterials;

MemoryWriteBuffer buf;

NxInitCooking();
NxTriangleMeshShapeDesc mShapeDesc;
if(NxCookTriangleMesh(mTriangleMeshDescription, buf))
mShapeDesc.meshData = world::getSingleton().mPhysicsSDK->createTriangleMesh(MemoryReadBuffer(buf.data));

pose _pos = pose(offsetVector);
NxActorDesc mActorDescription;
mActorDescription.setToDefault();
mActorDescription.density = 10.0;
mActorDescription.globalPose.t = _pos;
mActorDescription.globalPose.M.fromQuat(_pos);


but I don't know how to make a body! I can't figure out a way to get a shape from a shapeDesc.

betajaen

13-02-2007 17:32:17

I'll be creating a rawMeshShape in the near future, that'll except point to vertices, faces and so on. Which should be more than suitable for what your doing.

I'll let you know, when it is time to update the secret link :wink: