Cache broadphases and container rejig (#3407)

This commit is contained in:
Leon Friedrich
2022-10-31 10:06:08 +11:00
committed by GitHub
parent cec14ae861
commit 2b594f6356
33 changed files with 851 additions and 720 deletions
@@ -88,18 +88,15 @@ namespace Robust.Shared.Physics.Systems
int collisionMask,
bool approximate = true,
PhysicsComponent? body = null,
FixturesComponent? fixtureComp = null)
FixturesComponent? fixtureComp = null,
TransformComponent? xform = null)
{
var entities = new HashSet<EntityUid>();
if (!Resolve(uid, ref body, ref fixtureComp, false))
if (!Resolve(uid, ref body, ref fixtureComp, ref xform, false))
return entities;
var broadQuery = GetEntityQuery<BroadphaseComponent>();
var xformQuery = GetEntityQuery<TransformComponent>();
var broadphase = _lookup.GetBroadphase(uid, xformQuery.GetComponent(uid), broadQuery, xformQuery);
if (broadphase == null)
if (!_lookup.TryGetCurrentBroadphase(xform, out var broadphase))
return entities;
var state = (body, entities);