perf: physics engine memory leaks fixed

This commit is contained in:
2025-05-29 22:33:47 +03:00
parent bf8fbebae3
commit 9bf17cc191
2 changed files with 15 additions and 15 deletions

View File

@@ -45,12 +45,12 @@ public class PhysicsEngine2DStandalone : IPhysicsEngine2D
for (int iterationIndex = 0; iterationIndex < IterationPerStep; iterationIndex++)
{
// Can Parallel
for (int i = 0; i < rigidBodies.Count; i++)
for (int i = rigidBodies.Count - 1; i >= 0; i--)
StepRigidBody(rigidBodies[i], intervalDeltaTime);
// Can Parallel
foreach (ICollider2D collider in colliders)
collider.Recalculate();
for (int i = colliders.Count - 1; i >= 0; i--)
colliders[i].Recalculate();
// Can Parallel
for (int x = 0; x < colliders.Count; x++)