Skip to content

Commit 6d4b9d7

Browse files
fix
Assuring the default non-info contact event handler sets priority to the non-kinematic bodies.
1 parent e8b8a45 commit 6d4b9d7

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

com.unity.netcode.gameobjects/Runtime/Components/RigidbodyContactEventManager.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ private void ProcessCollisions()
179179
{
180180
m_HandlerInfo[contactEventHandler.Key] = handlerWithInfo.GetContactEventHandlerInfo();
181181
}
182+
else
183+
{
184+
var info = m_HandlerInfo[contactEventHandler.Key];
185+
info.HasContactEventPriority = !m_RigidbodyMapping[contactEventHandler.Key].isKinematic;
186+
m_HandlerInfo[contactEventHandler.Key] = info;
187+
}
182188
}
183189

184190
ContactEventHandlerInfo contactEventHandlerInfo0;
@@ -235,17 +241,14 @@ private void ProcessCollisions()
235241
}
236242
}
237243

238-
if (preferredContactHandler == null)
244+
if (preferredContactHandler == null && otherContactHandler != null)
239245
{
240-
if (otherContactHandler != null)
241-
{
242-
preferredContactHandler = otherContactHandler;
243-
preferredContactHandlerNonRigidbody = otherContactHandlerNonRigidbody;
244-
preferredRigidbody = otherRigidbody;
245-
otherContactHandler = null;
246-
otherContactHandlerNonRigidbody = false;
247-
otherRigidbody = null;
248-
}
246+
preferredContactHandler = otherContactHandler;
247+
preferredContactHandlerNonRigidbody = otherContactHandlerNonRigidbody;
248+
preferredRigidbody = otherRigidbody;
249+
otherContactHandler = null;
250+
otherContactHandlerNonRigidbody = false;
251+
otherRigidbody = null;
249252
}
250253

251254
if (preferredContactHandler == null || (preferredContactHandler != null && otherContactHandler == null && !preferredContactHandlerNonRigidbody))

0 commit comments

Comments
 (0)