feat(physics): Engine Rigidbody2D Static Check

This commit is contained in:
Syntriax 2024-01-28 14:56:13 +03:00
parent 1ffddab2c1
commit dc96b93024
1 changed files with 4 additions and 0 deletions

View File

@ -65,6 +65,10 @@ public class PhysicsEngine2D : IPhysicsEngine2D
if (bothCollidersAreTriggers) if (bothCollidersAreTriggers)
continue; continue;
bool bothCollidersAreStatic = colliderX.RigidBody2D?.IsStatic ?? true && colliderX.RigidBody2D?.IsStatic == colliderY.RigidBody2D?.IsStatic;
if (bothCollidersAreStatic)
continue;
if (collisionDetector.TryDetect(colliderX, colliderY, out CollisionDetectionInformation information)) if (collisionDetector.TryDetect(colliderX, colliderY, out CollisionDetectionInformation information))
{ {
if (colliderX.IsTrigger) if (colliderX.IsTrigger)