From 597804b0c69ce7888a9606a20ada01c8b173000f Mon Sep 17 00:00:00 2001 From: Hugo Rambure <32395687+Nodli@users.noreply.github.com> Date: Mon, 27 Jun 2022 22:15:48 +0200 Subject: [PATCH] Fix index computation from PxF32 to PxU32 --- physx/source/geomutils/src/hf/GuHeightField.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physx/source/geomutils/src/hf/GuHeightField.cpp b/physx/source/geomutils/src/hf/GuHeightField.cpp index 8a40f3bcb..fdecfd8fb 100644 --- a/physx/source/geomutils/src/hf/GuHeightField.cpp +++ b/physx/source/geomutils/src/hf/GuHeightField.cpp @@ -703,7 +703,7 @@ PxU32 Gu::HeightField::computeCellCoordinates(PxReal x, PxReal z, PxReal& fracX, PX_ASSERT(x >= 0.0f && x < PxF32(mData.rows)); PX_ASSERT(z >= 0.0f && z < PxF32(mData.columns)); - const PxU32 vertexIndex = PxU32(x * (mData.nbColumns) + z); + const PxU32 vertexIndex = PxU32(x) * mData.columns + PxU32(z); PX_ASSERT(vertexIndex < (mData.rows)*(mData.columns)); return vertexIndex;