I need the normal at a grid point on the heightfield.
I can already query the height with PxHeightfield::getHeight(x,z) and I could also draft a normal using multiple sample points. However, I want the normal to match whatever PhysX uses internally and don’t want to reproduce all the internal normal code. I also can’t due to several other functions not being exposed.
There is PxHeightfield::getTriangleNormal, which is perfect, but there seems to be no public way of mapping from grid co-ordinates to heightfield triangle ID.
There is physx::Gu::Heightfield::getTriangleIndex(x,z) which would solve all my issues but that’s not publicly exposed.
Is there any other way of getting the triangle normal other than adding a virtual forwarding call from PxHeightfield to getTriangleIndex?