fix: fixed an issue where when there is an inactive collider in the universe messing up the physics engine

This commit is contained in:
Syntriax 2025-05-27 13:52:53 +03:00
parent d3fb612904
commit 4213b3f8b5
2 changed files with 4 additions and 4 deletions

View File

@ -49,14 +49,14 @@ public class PhysicsEngine2D : UniverseObject, IPhysicsEngine2D
{
ICollider2D? colliderX = colliderCollector.Behaviours[x];
if (!colliderX.IsActive)
return;
continue;
for (int y = x + 1; y < colliderCollector.Behaviours.Count; y++)
{
ICollider2D? colliderY = colliderCollector.Behaviours[y];
if (!colliderY.IsActive)
return;
continue;
if (colliderX.RigidBody2D == colliderY.RigidBody2D)
continue;

View File

@ -57,14 +57,14 @@ public class PhysicsEngine2DStandalone : IPhysicsEngine2D
{
ICollider2D? colliderX = colliders[x];
if (!colliderX.IsActive)
return;
continue;
for (int y = x + 1; y < colliders.Count; y++)
{
ICollider2D? colliderY = colliders[y];
if (!colliderY.IsActive)
return;
continue;
if (colliderX.RigidBody2D == colliderY.RigidBody2D)
continue;