Closest Method

See Also Applies To Example Model

Returns the closest object within the specified radius.

object expression.Closest ([Radius], [Angle])

object expression    Required. An object expression that evaluates to an object in the Applies To list.

Radius    Optional Double. The radius distance within which to perform the search. Defaults to infinity.

Angle    Optional Double. The span angle that defines the area to perform the search.

Remarks

The default values for Radius and Angle are defined with the ViewField object.

When the Bounds property of the Screen object is set to wrapped mode, the closest distance to an object is along the shortest of all possible paths after accounting for wrapping around each of the Screen display edges.

Example

The following example finds the closest Bot 20 distance units and sets it's color.

Bot.Closest(20).Color = Bot.Color