示例#1
0
        /// <summary>
        /// Attempts to find the corrosponding <see cref="Index"/> from a position in 3D space.
        /// This method is very expensive and performs a distance check for every node in the seach space.
        /// This method will always return the <see cref="Index"/> that is the shortest distance from the specified position even if this position is well outside the bounds of the grid.
        /// </summary>
        /// <param name="worldPosition">The position in 3D space to try and find an index for</param>
        /// <returns>The closest <see cref="Index"/> to the specified world position</returns>
        public Index findNearestIndex(Vector3 worldPosition)
        {
            // Make sure the grid is ready
            if (verifyReady() == false)
            {
                return(null);
            }

            // Pass the call through to the raw grid
            return(searchGrid.findNearestIndex(worldPosition));
        }