Use object-spaced bounding boxes for putting stuff in crates (#21427)

* Use object-spaced bounding boxes for putting stuff in crates

* Use existing _lookup.GetAABB, different component

* PR edits updated

* Remove unused bits from around GetAABB

* Use GetAABBNoContainer
This commit is contained in:
Christopher Thirtle
2023-11-05 20:40:25 -06:00
committed by GitHub
parent 5af97da997
commit d07ea20f74

View File

@@ -368,13 +368,9 @@ public abstract class SharedEntityStorageSystem : EntitySystem
if (toAdd == container)
return false;
if (TryComp<PhysicsComponent>(toAdd, out var phys))
{
var aabb = _physics.GetWorldAABB(toAdd, body: phys);
if (component.MaxSize < aabb.Size.X || component.MaxSize < aabb.Size.Y)
return false;
}
var aabb = _lookup.GetAABBNoContainer(toAdd, Vector2.Zero, 0);
if (component.MaxSize < aabb.Size.X || component.MaxSize < aabb.Size.Y)
return false;
return Insert(toAdd, container, component);
}