Skip to content
Permalink
Browse files

[Physics] CleanContacts was working on previousFrameContacts rather t…

…han currentFrameContacts, resulting in warnings "Pair not present". Thanks @EternalTamago for the fix! (fixes #88)
  • Loading branch information
xen2 committed Mar 26, 2019
1 parent 89e92e4 commit 93c111a179675384a09a6a7c7a43d0a643f63fce
Showing with 9 additions and 9 deletions.
  1. +9 −9 sources/engine/Xenko.Physics/Simulation.cs
@@ -1249,26 +1249,26 @@ internal unsafe void ContactTest(PhysicsComponent component)
}
}

private readonly FastList<ContactPoint> previousToRemove = new FastList<ContactPoint>();
private readonly FastList<ContactPoint> currentToRemove = new FastList<ContactPoint>();

internal void CleanContacts(PhysicsComponent component)
{
previousToRemove.Clear(true);
currentToRemove.Clear(true);

foreach (var previousFrameContact in previousFrameContacts)
foreach (var currentFrameContact in currentFrameContacts)
{
var component0 = previousFrameContact.ColliderA;
var component1 = previousFrameContact.ColliderB;
var component0 = currentFrameContact.ColliderA;
var component1 = currentFrameContact.ColliderB;
if (component == component0 || component == component1)
{
previousToRemove.Add(previousFrameContact);
ContactRemoval(previousFrameContact, component0, component1);
currentToRemove.Add(currentFrameContact);
ContactRemoval(currentFrameContact, component0, component1);
}
}

foreach (var contactPoint in previousToRemove)
foreach (var contactPoint in currentToRemove)
{
previousFrameContacts.Remove(contactPoint);
currentFrameContacts.Remove(contactPoint);
}
}
}

0 comments on commit 93c111a

Please sign in to comment.
You can’t perform that action at this time.