Prechádzať zdrojové kódy

Fix RigidBodyBullet areasWhereIam element shift.

Marcel Admiraal 5 rokov pred
rodič
commit
edc4820430
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      modules/bullet/rigid_body_bullet.cpp

+ 2 - 2
modules/bullet/rigid_body_bullet.cpp

@@ -858,8 +858,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.write[j + 1] = areasWhereIam[j];
+				for (int j = areaWhereIamCount; j > i; j--) {
+					areasWhereIam.write[j] = areasWhereIam[j - 1];
 				}
 				areasWhereIam.write[i] = p_area;
 				break;