PxHeightfield* Documentation and Samples - Issues and Clarifications

I’m attempting to use a heightfield as the collision shape for my procedurally generated terrain, as documentation suggested this would be the most appropriate shape for my case.

However, I’ve yet to find any samples of heightfields in the SDK or online, for that matter. In the documentation, a very concise example is given, but neither documentation nor the samples is clear on the order of translation via the local pose and scaling via the heightfield parameters. Whether the patch of samples is centered on the shape’s pose or if it begins at the shape’s pose and extends in the local X and Z axes is also unclear.

Additionally, while trying to discover this my self through experimentation, the scene seems to have no debug points, lines, or triangles. I haven’t been able to establish any form of collision with my heightfield, even with default values and sample heights of 0 with scales of 1.0 in all axes. I have set values for all the relevant visualization parameters I could find on the scene, actor, and shape:

PhysXScene->setVisualizationParameter(physx::PxVisualizationParameter::eSCALE, 1.0f);
PhysXScene->setVisualizationParameter(physx::PxVisualizationParameter::eCOLLISION_SHAPES, true);
PhysXHeightFieldShape->setFlag(physx::PxShapeFlag::eVISUALIZATION, true);
PhysXRigidStatic->setActorFlag(physx::PxActorFlag::eVISUALIZATION, true);

Other actors seem to collide with each other and, even without setting their own visualization actor and shape flags, increase the number of debug visualization data in the scene’s render buffer, but the height field does not.

I’m at a loss for further debugging at the moment - might there be suggestions as to how to proceed with debugging this situation?

Additional details: I have no errors or warnings in the VS2012 Output window, though I know that it is working. I’ve tried using both the DEBUG and CHECKED configurations. I’ve also confirmed that the actors/shapes that are not colliding with terrain are able to collide with each other. I’ve tried with gravity disabled, and with simulation disabled or enabled on the rigid static actor, with no change in behavior.

Update: I’d been under the impression that the PhysX Visual Debugger required a source license, but it seems not. However, the installer immediately fails with the following message:

“NVIDIA PhysX Visual Debugger requires .NET Framework 3.0. Setup has encountered a problem. Setup will now exit”

This is not the case, however. I’m unable to install PVD, but .NET framework 3.0 is absolutely installed and functional.

Further attempts to resolve the issue have been futile. I’ve confirmed that the registry settings typically used to detect .NET Framework 3.0 are present according to this official documentation (http://support.microsoft.com/kb/318785) - .NET Framework 3.0 Service Pack 2 is installed. Furthermore, the directory %SYSTEMROOT%\Microsoft.NET\Framework64\v3.0\ has contents that look appropriate. The 32-bit version of that path also has contents that look appropriate. I’ve sent a bug report for this situation. I have tried multiple downloads and even multiple versions of the PVD installer with no success.

Finally, success.

  • Uninstalled and reinstalled all .NET Frameworks, which fixed the installation issues for PVD.
  • I had completely forgotten to add my static rigid actor to the scene - in testing PhysX, I haven't yet built a proper system to automate actor creation and addition to a scene.
  • My coordinate system was considerably different than what PhysX was using, so I needed to exchange and/or invert some axes.

I’m not sure why the .NET Framework worked fine for all other applications, including my own development, but a full uninstall and reinstall of all .NET Frameworks resolved the issue.

It does seem like the height field’s corner is at the shape’s origin, for what that is worth to anyone who seeks this information some day. Also, the scaling passed when creating the heightfield applies to the values from the heightfield samples before application of the shape’s transform to the heightfield.