Open hazidh opened 3 weeks ago
Getting back the triangle data from the mesh is not yet supported. I would recommend to keep and use the data that you used to construct the PxTriangleMeshGeometry
.
Getting back the triangle data from the mesh is not yet supported. I would recommend to keep and use the data that you used to construct the
PxTriangleMeshGeometry
.
Hello,because my scene needs to obtain the indices of a PxTriangleMesh to build Mesh with another 3D engine.If so, what should I do to get the indices of a PxTriangleMesh?
To create a PxTriangleMeshGeometry
you first create a PxTriangleMeshDesc
where you put in your triangle data, the points and the indices. There you have your indices just use them. If you don't create a PxTriangleMeshDesc
with that data you won't get a valid PxTriangleMesh
/ PxTriangleMeshGeometry
in the first place.
Yes,this is a methoed.I also can get the indices by this way.
short[] index = new short[nbTriangles * 3]; NativeObject triangles1 = triangleMesh.getTriangles(); PxU16Ptr ptr = NativeArrayHelpers.voidToU16Ptr(triangles1); for (int i = 0; i < nbTriangles; i++) { index[i * 3] = NativeArrayHelpers.getU16At(ptr, i * 3); index[i * 3 + 1] = NativeArrayHelpers.getU16At(ptr, i * 3 + 1); index[i * 3 + 2] = NativeArrayHelpers.getU16At(ptr, i * 3 + 2); }
Now I want to create a CovexMesh through this way,what should I do?I can't create it.
`PxConvexMeshDesc convexDesc;
convexDesc.points.count = 12;
convexDesc.points.stride = sizeof(PxVec3);
convexDesc.points.data = convexVerts;
convexDescPolygons.polygons.count = 20;
convexDescPolygons.polygons.stride = sizeof(PxHullPolygon);
convexDescPolygons.polygons.data = hullPolygons;
convexDesc.flags = 0;
PxDefaultMemoryOutputStream buf; if(!PxCookConvexMesh(cookingParams, convexDesc, buf)) return NULL;`
PxConvexMesh
works pretty similar to triangle mesh. The code you pasted seems to be C++ though...
Here is how I do it in my engine (it's kotlin, but it uses the Java lib and it should work exactly the same in Java).
Any by the way you can insert multi-line code snippets by using three backticks before and after the code snippet instead of a single one.
Hello,I create a PxTriangleMeshGeometry,then I want to get its mesh indices.What should I do?I see that the function of PxTriangleMesh.getTriangles returns NativeObjects which not PxArray_PxU32 or PxArray_PxU16.I would appreciate your reply