Explorar el Código

Merge pull request #42061 from madmiraal/fix-41743

Fix Bullet prioritised list of Areas a RigidBody is a member of element shift.
Rémi Verschelde hace 5 años
padre
commit
3a8a0bc5d3
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      modules/bullet/rigid_body_bullet.cpp

+ 2 - 2
modules/bullet/rigid_body_bullet.cpp

@@ -849,8 +849,8 @@ void RigidBodyBullet::on_enter_area(AreaBullet *p_area) {
 		} else {
 			if (areasWhereIam[i]->get_spOv_priority() > p_area->get_spOv_priority()) {
 				// The position was found, just shift all elements
-				for (int j = i; j < areaWhereIamCount; ++j) {
-					areasWhereIam[j + 1] = areasWhereIam[j];
+				for (int j = areaWhereIamCount; j > i; j--) {
+					areasWhereIam[j] = areasWhereIam[j - 1];
 				}
 				areasWhereIam[i] = p_area;
 				break;