diff --git a/docs/reference/changelog-r2023.md b/docs/reference/changelog-r2023.md index c5a3b3a0f3b..e78d7a0db20 100644 --- a/docs/reference/changelog-r2023.md +++ b/docs/reference/changelog-r2023.md @@ -15,6 +15,7 @@ Released on XXX XXth, 2023. - Fixed a crash when [IndexedLineSet](indexedlineset.md) has `coord` but no `coordIndex` ([#6359](https://github.com/cyberbotics/webots/pull/6359)). - Fixed values returned by the [Receiver.getEmitterDirection](https://cyberbotics.com/doc/reference/receiver?tab-language=python#wb_receiver_get_emitter_direction) Python method ([#6394](https://github.com/cyberbotics/webots/pull/6394)). - Fixed recognition of omnidirectional cameras with fov > pi/2 in [WbObjectDetection] ([#6396](https://github.com/cyberbotics/webots/pull/6396)). + - Fixed [ElevationGrid](elevationgrid.md) collisions not matching the displayed when the x and y dimensions are different ([#6412](https://github.com/cyberbotics/webots/pull/6412)) ## Webots R2023b Released on June 28th, 2023. diff --git a/src/webots/nodes/WbElevationGrid.cpp b/src/webots/nodes/WbElevationGrid.cpp index 2c6d5b1ceb1..1d2c5023b1f 100644 --- a/src/webots/nodes/WbElevationGrid.cpp +++ b/src/webots/nodes/WbElevationGrid.cpp @@ -429,11 +429,11 @@ bool WbElevationGrid::setOdeHeightfieldData() { mHeight->copyItemsTo(mData, xdyd); // Inverse mData lines for ODE - for (int i = 0; i < xd / 2; i++) { // integer division - for (int j = 0; j < yd; j++) { - double temp = mData[i * yd + j]; - mData[i * yd + j] = mData[(xd - 1 - i) * yd + j]; - mData[(xd - 1 - i) * yd + j] = temp; + for (int i = 0; i < yd / 2; i++) { // integer division + for (int j = 0; j < xd; j++) { + double temp = mData[i * xd + j]; + mData[i * xd + j] = mData[(yd - 1 - i) * xd + j]; + mData[(yd - 1 - i) * xd + j] = temp; } }