Garry's Mod Wiki

Entity:NearestPoint

  Vector Entity:NearestPoint( Vector position )

Description

Performs a Ray-Orientated Bounding Box intersection from the given position to the origin of the OBBox with the entity and returns the hit position on the OBBox.

This relies on the entity having a collision mesh (not a physics object) and will be affected by SOLID_NONE

Arguments

1 Vector position
The vector to start the intersection from.

Returns

1 Vector
The nearest hit point of the entity's bounding box in world coordinates.