🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Problem of parameters with Physx for cooking

Started by
0 comments, last by theScore 4 years, 6 months ago

Hello !
I use Physx 4.1 for windows 10.
I have a problem with cooking, the method fail every time, saying that "meshDesc" has a wrong parameter. But I don't see ant error with "meshDesc". Can you help me ?
this is the source code :

PxTolerancesScale scale;
			PxCookingParams params(scale);
			
			// disable mesh cleaning - perform mesh validation on development configurations
			params.meshPreprocessParams |= PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH;
			
			// disable edge precompute, edges are set for each triangle, slows contact generation
			//params.meshPreprocessParams |= PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE;
			
			// lower hierarchy for internal mesh
			//params.meshCookingHint = PxMeshCookingHint::eCOOKING_PERFORMANCE;


			cooking->setParams(params);


			PxVec3* vertices = new PxVec3[Loader3dsData::Loader3ds::objectsData[i].nbVertices];
			memcpy(vertices, Loader3dsData::Loader3ds::objectsData[i].vertices, sizeof(PxVec3) * Loader3dsData::Loader3ds::objectsData[i].nbVertices);


			PxU16* indices = new PxU16[Loader3dsData::Loader3ds::objectsData[i].nbTriangles];
			memcpy(indices, Loader3dsData::Loader3ds::objectsData[i].indices, sizeof(PxU16) * Loader3dsData::Loader3ds::objectsData[i].nbTriangles*3);




			PxTriangleMeshDesc meshDesc;
			meshDesc.points.count = Loader3dsData::Loader3ds::objectsData[i].nbVertices;
			meshDesc.points.stride = sizeof(PxVec3);// Loader3dsData::fVector);
			meshDesc.points.data = vertices;//Loader3dsData::Loader3ds::objectsData[i].vertices;


			meshDesc.triangles.count = Loader3dsData::Loader3ds::objectsData[i].nbTriangles;
			meshDesc.triangles.stride = 3* sizeof(PxU16);
			meshDesc.triangles.data = indices;//Loader3dsData::Loader3ds::objectsData[i].indices;




#ifdef _DEBUG
			// mesh should be validated before cooked without the mesh cleaning
			bool res = cooking->validateTriangleMesh(meshDesc);
			PX_ASSERT(res);
#endif


			PxTriangleMesh* aTriangleMesh = cooking->createTriangleMesh(meshDesc, physics->getPhysicsInsertionCallback());

This topic is closed to new replies.

Advertisement