diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 1aba31f03d2..b590d63167e 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/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::Read r = heights.read(); - int heights_size = heights.size(); + PoolVector::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; + } } }