void CollisionForPushBox() { foreach (PhysicsComponent physicsEntity in m_PhysicsEntities) { foreach (PhysicsComponent other in m_PhysicsEntities) { if (physicsEntity == other) { continue; } BoxOverlap overlap = PhysicsUtility.GetOverlapOfBox(physicsEntity.PushBox, other.PushBox); if (PhysicsUtility.AreBoxesIntersecting(physicsEntity.PushBox, other.PushBox)) { physicsEntity.transform.Translate(new Vector3(overlap.x, 0) * 0.5f); other.transform.Translate(new Vector3(overlap.x, 0) * -0.5f); } return; } } }