Example #1
0
 public Seeker(Vector3 startPosition, Vector3 endPosition, Navigator owner)
 {
     m_StartPosition = startPosition;
     m_EndPosition = endPosition;
     m_Owner = owner;
     m_IterationCap = Navigation.SeekerIterationCap;
 }
Example #2
0
        /// Returns nearest node to a position for a given Navigator. If the Navigator has non-zero pathBlockingLayers
        /// specified, each potential node will be checked for accessibility with a sphere cast.
        public static Waypoint GetNearestNode(Vector3 position, Navigator navigator)
        {
            Waypoint nearest = null;

            foreach (Waypoint waypoint in Navigation.Waypoints)
            {
                if (
                    waypoint.Enabled &&
                    (
                        nearest == null ||
                        (nearest.Position - position).sqrMagnitude > (waypoint.Position - position).sqrMagnitude
                    ) &&
                    (
                        (waypoint.Position - position).magnitude < waypoint.Radius ||
                        navigator == null ||
                        navigator.DirectPath (position, waypoint.Position)
                    )
                )
                {
                    nearest = waypoint;
                }
            }

            return nearest;
        }
Example #3
0
 internal Path(Vector3 startPosition, Vector3 endPosition, Navigator owner)
 {
     m_StartPosition = startPosition;
     m_EndPosition   = endPosition;
     m_Owner         = owner;
 }