Core/AreaTrigger Update box searching to handle oriented boxes
Port From (https://github.com/TrinityCore/TrinityCore/commit/4725941567f9dae583fc27b52b51a23aa84cd098)
This commit is contained in:
@@ -381,6 +381,9 @@ namespace Game.Entities
|
|||||||
|
|
||||||
void SearchUnitInBox(List<Unit> targetList)
|
void SearchUnitInBox(List<Unit> targetList)
|
||||||
{
|
{
|
||||||
|
SearchUnits(targetList, GetTemplate().MaxSearchRadius, false);
|
||||||
|
|
||||||
|
Position boxCenter = GetPosition();
|
||||||
float extentsX, extentsY, extentsZ;
|
float extentsX, extentsY, extentsZ;
|
||||||
|
|
||||||
unsafe
|
unsafe
|
||||||
@@ -390,24 +393,7 @@ namespace Game.Entities
|
|||||||
extentsZ = GetTemplate().BoxDatas.Extents[2];
|
extentsZ = GetTemplate().BoxDatas.Extents[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchUnits(targetList, GetTemplate().MaxSearchRadius, false);
|
targetList.RemoveAll(unit => !unit.IsWithinBox(boxCenter, extentsX, extentsY, extentsZ));
|
||||||
|
|
||||||
float halfExtentsX = extentsX / 2.0f;
|
|
||||||
float halfExtentsY = extentsY / 2.0f;
|
|
||||||
float halfExtentsZ = extentsZ / 2.0f;
|
|
||||||
|
|
||||||
float minX = GetPositionX() - halfExtentsX;
|
|
||||||
float maxX = GetPositionX() + halfExtentsX;
|
|
||||||
|
|
||||||
float minY = GetPositionY() - halfExtentsY;
|
|
||||||
float maxY = GetPositionY() + halfExtentsY;
|
|
||||||
|
|
||||||
float minZ = GetPositionZ() - halfExtentsZ;
|
|
||||||
float maxZ = GetPositionZ() + halfExtentsZ;
|
|
||||||
|
|
||||||
AxisAlignedBox box = new(new Vector3(minX, minY, minZ), new Vector3(maxX, maxY, maxZ));
|
|
||||||
|
|
||||||
targetList.RemoveAll(unit => !box.contains(new Vector3(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchUnitInPolygon(List<Unit> targetList)
|
void SearchUnitInPolygon(List<Unit> targetList)
|
||||||
|
|||||||
Reference in New Issue
Block a user