/// <summary> /// Return objects that are within <paramref name="maxDistance"/> of the specified <paramref name="ray"/>. /// If none, returns an empty array (not null). /// </summary> /// <param name="ray">The ray. Passing as ref to improve performance since it won't have to be copied.</param> /// <param name="maxDistance">Maximum distance from the ray to consider.</param> /// <returns>Objects within range.</returns> public List <T> GetNearby(Ray ray, float maxDistance) { var collidingWith = new List <T>(); RootNode.GetNearby(ref ray, ref maxDistance, ref collidingWith); return(collidingWith); }
/// <summary> /// Return objects that are within maxDistance of the specified ray. /// If none, returns an empty array (not null). /// </summary> /// <param name="ray">The ray. Passing as ref to improve performance since it won't have to be copied.</param> /// <param name="maxDistance">Maximum distance from the ray to consider.</param> /// <returns>Objects within range.</returns> public T[] GetNearby(Ray ray, float maxDistance) { var collidingWith = new List <T>(); RootNode.GetNearby(ref ray, ref maxDistance, collidingWith); return(collidingWith.ToArray()); }