ソースを参照

Fixes heightfield for non-square grids. Tested on rectangular heightmaps.

Ken Whatmough 13 年 前
コミット
ba23eea169
1 ファイル変更3 行追加3 行削除
  1. 3 3
      gameplay/src/PhysicsController.cpp

+ 3 - 3
gameplay/src/PhysicsController.cpp

@@ -1038,9 +1038,9 @@ PhysicsCollisionShape* PhysicsController::createHeightfield(Node* node, Image* i
             // which is just under 0.4%.
             //
             heights[x + y * w] = normalizedHeightPacked(
-                data[(x + y * h) * pixelSize + 0],
-                data[(x + y * h) * pixelSize + 1],
-                data[(x + y * h) * pixelSize + 2]) * (maxHeight - minHeight) + minHeight;
+                data[(x + y * w) * pixelSize + 0],
+                data[(x + y * w) * pixelSize + 1],
+                data[(x + y * w) * pixelSize + 2]) * (maxHeight - minHeight) + minHeight;
         }
     }