Przeglądaj źródła

Moved physics event dispatching to fire after every Step() call, not after all Step() calls are complete

Ivan Safrin 12 lat temu
rodzic
commit
8912d89935

+ 5 - 6
Modules/Contents/2DPhysics/Source/PolyPhysicsScreen.cpp

@@ -558,13 +558,12 @@ void PhysicsScreen::Update() {
 			physicsChildren[i]->Update();
 		}
 		world->Step(timeStep, velocityIterations,positionIterations);
+		
+		for(int i=0; i < eventsToDispatch.size(); i++) {
+			dispatchEvent(eventsToDispatch[i], eventsToDispatch[i]->getEventCode());
+		}
+		eventsToDispatch.clear();
 	}
-	
-	for(int i=0; i < eventsToDispatch.size(); i++) {
-		dispatchEvent(eventsToDispatch[i], eventsToDispatch[i]->getEventCode());
-	}
-	eventsToDispatch.clear();
-	
 	cyclesLeftOver = elapsed;
 	Screen::Update();
 }