Entity.VisibleVec
From GMod Wiki
Function | |
Syntax | Entity:VisibleVec( Vector vWorldPos ) |
Description: | |
Returns true if this entity can "see" the given position in the game world. False is returned otherwise. See additional notes for important information on this function. | |
Returns: | Boolean |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.VisibleVec]Entity.VisibleVec [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Print 'true' if myEnt can see the world position 0,0,0 |
---|---|
Used on | |
Code | print( myEnt:VisibleVec( Vector( 0, 0, 0 ) ) ) |
Output | true if visible, false if not. |
Additional notes
- This the same as Entity.Visible but takes a vector argument instead.
- This function uses PVS to determine if an entity can "see" a point. When a map is compiled, it divides the map into sectors called "visleafs". Each visleaf has a PVS, or partial visiblity set, which is a list of other visleafs the compiler has determined that visleaf can see. If a point is visible to an entity, it means one of the following is true:
- A. The entity and the point are in the same visleaf
- B. The point's visleaf is in the PVS of the entity's visleaf
- C. The current map was compiled without VVIS and has no visleafs, so everything is "visible" to everything.