namespace Opium.AI;
partial class Agent
{
/// <summary>
/// Checks for a door along a path
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
private void CheckForDoor( Vector3 a, Vector3 b )
{
var sweep = Scene.Trace.Box( CharacterController.BoundingBox, a, b ).WithAnyTags( "interact" ).Run();
if ( sweep.Hit && sweep.Distance < 16f )
{
if ( sweep.GameObject.Components.GetInChildrenOrSelf<DoorComponent>() != null )
TriggerEvent( "open_door", this );
}
}
}
