Entity.NearestPoint
From GMod Wiki
Function | |
Syntax | Entity:NearestPoint( Vector given ) |
Description: | |
Returns the closest point on the edge of the entity's bounding box to the given vector. See the image in Additonal Notes for more information. | |
Returns: | Vector |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.NearestPoint]Entity.NearestPoint [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Additional Notes
- As you can see on the right, a line is drawn from the center of the entity's bounding box to the vector. The point at which the border of the bounding box comes in contact with the line is the vector returned.
- You should note that this returns a world vector, and you can use entity:WorldToLocal(thisVec) to convert it.
- It seems to only return (0,0,0) when used on the world entity.