Im having a problem creating physx convex mesh. what im doing is taking all the mesh data from an ogre mesh ( which i have made sure, is working correctly), and using physx to convert it into a convex mesh.
When im collecting the vertices data from the ogre mesh, i use a dynamic array.
here it works fine, then i pass the pointer through a function
the last 3 parameters are nothign to be concerned of.
in the fucntion this is what i have got :
it always return false from the if statement above, some how it fails at the MemoryReadBuffe r( MemWrtBuf.data ) fucntion.
Im not sure what is wrong, is it something to do with the dll files? or my code? very stuck and confusing. I know alternative ways to do like using the stil list or vector list. I just like to know if anyone has any idea?
When im collecting the vertices data from the ogre mesh, i use a dynamic array.
Code:
pObjVertices = new (std::nothrow) NxVec3[ VertexAmount ];
Code:
CreateConvexVolume( pInstance->pObjVertices, pInstance->VertexAmount, NxVec3( 0.0, 0.0, 0.0 ), 100, false ) ) )
in the fucntion this is what i have got :
Code:
pConvexMeshDesc = new NxConvexMeshDesc(); pConvexMeshDesc->numVertices = uNumVerts; pConvexMeshDesc->pointStrideBytes = sizeof(NxVec3); pConvexMeshDesc->points = pVerts; pConvexMeshDesc->flags = NX_CF_COMPUTE_CONVEX; ConvexShapeDesc.localPose.t = NxVec3(0,0,0); ConvexShapeDesc.userData = pConvexMeshDesc; NxInitCooking(); // Cooking from memory if( !( bStatus = NxCookConvexMesh( *pConvexMeshDesc, MemWrtBuf ) ) ) return false; ConvexShapeDesc.meshData = C_PhysicsSDK->createConvexMesh( MemoryReadBuffer( MemWrtBuf.data ) ); if ( ConvexShapeDesc.meshData ) { ActorDesc.shapes.pushBack(&ConvexShapeDesc); if (Density) { ActorDesc.body = &BodyDesc; ActorDesc.density = Density; } else { ActorDesc.body = NULL; } ActorDesc.globalPose.t = Pos; NxActor* pObjActor = C_Scene->createActor(ActorDesc); if( Racer ) NxActorList.push_back( pObjActor ); else pTrackActor = pObjActor; } return false;
Im not sure what is wrong, is it something to do with the dll files? or my code? very stuck and confusing. I know alternative ways to do like using the stil list or vector list. I just like to know if anyone has any idea?