From 9f522bdb66ff641867001c624b7fe8fc50aa54db Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sat, 2 Nov 2024 09:39:53 +0300 Subject: [PATCH] fix: Physics Engine Not Resolving Static Objects Correctly --- Engine.Physics2D/PhysicsEngine2D.cs | 2 +- Engine.Physics2D/PhysicsEngine2DCollector.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine.Physics2D/PhysicsEngine2D.cs b/Engine.Physics2D/PhysicsEngine2D.cs index 217396e..bbe6f59 100644 --- a/Engine.Physics2D/PhysicsEngine2D.cs +++ b/Engine.Physics2D/PhysicsEngine2D.cs @@ -74,7 +74,7 @@ public class PhysicsEngine2D : IPhysicsEngine2D if (bothCollidersAreTriggers) continue; - bool bothCollidersAreStatic = colliderX.RigidBody2D?.IsStatic ?? true && colliderX.RigidBody2D?.IsStatic == colliderY.RigidBody2D?.IsStatic; + bool bothCollidersAreStatic = (colliderX.RigidBody2D?.IsStatic ?? true) && (colliderY.RigidBody2D?.IsStatic ?? true); if (bothCollidersAreStatic) continue; diff --git a/Engine.Physics2D/PhysicsEngine2DCollector.cs b/Engine.Physics2D/PhysicsEngine2DCollector.cs index 0f6abc2..0cc06f2 100644 --- a/Engine.Physics2D/PhysicsEngine2DCollector.cs +++ b/Engine.Physics2D/PhysicsEngine2DCollector.cs @@ -56,7 +56,7 @@ public class PhysicsEngine2DCollector : HierarchyObjectBase, IPhysicsEngine2D if (bothCollidersAreTriggers) continue; - bool bothCollidersAreStatic = colliderX.RigidBody2D?.IsStatic ?? true && colliderX.RigidBody2D?.IsStatic == colliderY.RigidBody2D?.IsStatic; + bool bothCollidersAreStatic = (colliderX.RigidBody2D?.IsStatic ?? true) && (colliderY.RigidBody2D?.IsStatic ?? true); if (bothCollidersAreStatic) continue;