Hi,
I want to be able to create a terrain rapresentation.
This is the code of my method that create a RigidStaticActor composed by a ConvexMesh:
physx::PxTransform xPosition = physx::PxTransform(physx::PxVec3(0, 0, 0), physx::PxQuat(physx::PxPi*0.25f, physx::PxVec3(0, 1, 0)));
physx::PxMaterial* pxMaterial = m_pxPhysics->createMaterial(0.3, 0.3, 0.0);
...
physx::PxConvexMeshDesc xMeshDesc;
xMeshDesc.points.count = 10000;
xMeshDesc.points.stride = sizeof(physx::PxVec3);
xMeshDesc.points.data = convexVerts;
xMeshDesc.flags = physx::PxConvexFlag::eCOMPUTE_CONVEX;
xMeshDesc.vertexLimit = 256;
physx::PxDefaultMemoryOutputStream xOutPutStream;
if (false == m_pxCooking->cookConvexMesh(xMeshDesc, xOutPutStream))
{
return nullptr;
}
physx::PxDefaultMemoryInputData xInputStream(xOutPutStream.getData(), xOutPutStream.getSize());
physx::PxConvexMesh* pxConvexMesh = m_pxPhysics->createConvexMesh(xInputStream);
physx::PxRigidStatic* pxRigidStatic = 0;
pxRigidStatic = m_pxPhysics->createRigidStatic(xPosition);
physx::PxShape* pxCurrentShape = pxRigidStatic->createShape(physx::PxConvexMeshGeometry(pxConvexMesh), *pxMaterial);
return pxRigidStatic;
convexVerts is an Array that contail 10000 vertex in ECEF coordinates (an example of a single value is physx::PxVec3(3160.55652,503.6214573,5498.902)).
When a try to run my application on the PVD I can see only a little strange representation (in attachment) and if I check my ConvexMesh proprieties I can found that there are only 4 vertices…
Can anyone help me please? Any suggestion? This is the correct way to proceed?
Regards.