瀏覽代碼

Fix wrong heights data used to compute min and max heights

(cherry picked from commit cdcdba704b989aa9d7decc40d3181f8378378512)
Marc Gilleron 6 年之前
父節點
當前提交
c94e80a0a3
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      modules/bullet/shape_bullet.cpp

+ 5 - 4
modules/bullet/shape_bullet.cpp

@@ -510,16 +510,17 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) {
 	// Compute min and max heights if not specified.
 	if (!d.has("min_height") && !d.has("max_height")) {
 
-		PoolVector<real_t>::Read r = heights.read();
-		int heights_size = heights.size();
+		PoolVector<real_t>::Read r = l_heights.read();
+		int heights_size = l_heights.size();
 
 		for (int i = 0; i < heights_size; ++i) {
 			real_t h = r[i];
 
-			if (h < l_min_height)
+			if (h < l_min_height) {
 				l_min_height = h;
-			else if (h > l_max_height)
+			} else if (h > l_max_height) {
 				l_max_height = h;
+			}
 		}
 	}