Merge pull request #27687 from Zylann/fix_heightmap_shape_min_max

Fix wrong heights data used to compute min and max heights
This commit is contained in:
Rémi Verschelde 2019-04-05 11:52:22 +02:00 committed by GitHub
commit 6a33727cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
}
}