Hi,
In the past few days I have tryed to create a HeightField in PhysX using the Samples and the “Users Guide”
But it still dont work.
My Creation Process is the following:
void CPhysic::CreateHeightfield(GLuint* intImageData, int size, PxVec3 Pos)
{
PxHeightFieldDesc hfdesc;
PxRigidStatic* HeightFieldActor;
PxHeightFieldSample* samples = new PxHeightFieldSample;
for(int i = 0; i<(size*size); i++)
{
samples[i].height = intImageData[i];
}
hfdesc.format = PxHeightFieldFormat::eS16_TM;
hfdesc.nbColumns = size;
hfdesc.nbRows = size;
hfdesc.samples.data = samples;
hfdesc.samples.stride = sizeof(PxHeightFieldSample);
PxHeightField* aHeightField = gPhysicsSDK->createHeightField(hfdesc);
PxHeightFieldGeometry hfGeom(aHeightField, PxMeshGeometryFlags(), 1310, 1, 1);
HeightFieldActor = gPhysicsSDK->createRigidStatic(PxTransform(PxVec3(0.0f, 0.0f, 0.0f)));
PxShape* aHeightFieldShape = HeightFieldActor->createShape(hfGeom, *PlaneDefaultMaterial);
gScene->addActor(*HeightFieldActor);
}
intImageData is an array wich is Initialized as followed:
GLuint* intImageData = new GLuint[2048*2048];
for(int i=0;i<2048*2048;i++)
{
intImageData[i]=(unsigned int) ImageData[i];
}
ImageData is an array of GLshort values.
I hope someone can help me.
lg Dropye