Fix static ent collision spawn (#5933)

* Fix static ent collision spawn

* Fix test

* cool
This commit is contained in:
metalgearsloth
2025-05-15 19:11:20 +10:00
committed by GitHub
parent 2ac7bc3ce4
commit 73f6555624
3 changed files with 64 additions and 1 deletions

View File

@@ -294,6 +294,14 @@ public abstract partial class SharedPhysicsSystem
DebugTools.Assert(!fixB.Contacts.ContainsKey(fixA));
fixB.Contacts.Add(fixA, contact);
bodB.Contacts.AddLast(contact.BodyBNode);
// If it's a spawned static ent then need to wake any contacting entities.
// The issue is that static ents can never be awake and if it spawns on an asleep entity never gets a contact.
// Checking only bodyA should be okay because if bodyA is the other ent (i.e. dynamic / kinematic) then it should already be awake.
if (bodyA.BodyType == BodyType.Static && !bodyB.Awake)
{
WakeBody(uidB, body: bodyB);
}
}
/// <summary>