For the complete documentation index, see llms.txt. This page is also available as Markdown.

math.findBestVisiblePoint

findBestVisiblePoint(eyes, bb): Vec3

Finds the closest point on a bounding box that can be seen from the given eye position without a block in the way.

Parameters

eyes

Vec3

The position to look from, usually the local player's eyes.

bb

AxisAlignedBB

The bounding box to look at.

Returns

Vec3

The nearest unobstructed point, or null when every point is blocked.

Remarks

Points along the vertical center of the box are preferred over its corners. This raytraces blocks, so it is not free, call it once per target per tick rather than per frame.

Example

Last updated