Skip to content

PVS and PAS

Nak edited this page Sep 18, 2022 · 7 revisions

PVS (Potentially Visible Set) and PAS (Potentially Audible Set) is a set of collection of VisLeaf's, which might be visible from a given location. Thanks to them being pre-compiled by hammer, it is a very fast method of checking areas.

PVS is mostly used for render-checks, while NPC's are known to use PAS to react to sounds.

See more at:


PVS and PAS are generated from the map-file, but I've added a few helper functions to make it easier for checks and calculations for the map you're currently on. For anything more advanced, you need to use the BSPObject functions below.

Returns Functions Description
PVS NikNaks.PVS() Returns the PVS from the EyePos ( CLIENT ONLY! )
Boolean NikNaks.PVS.IsPositionVisible( Vector position, Vector position2 ) Returns true if the two positions are in same PVS.
PAS NikNaks.PAS() Returns the PAS from the EyePos ( CLIENT ONLY! )
Boolean NikNaks.PAS.IsPositionVisible( Vector position, Vector position2 ) Returns true if the two positions are in same PAS.

PVS

Returns Functions Description
PVS BSPObject:CreatePVS() Creates an empty PVS
PVS BSPObject:PVSForOrigin( Vector position, PVS?) Creates a new or adds a position to a given PVS.
Boolean BSPObject:PVSCheck( Vector position, Vector position2 ) Returns true if the two positions is in same PVS.

Returns Functions Description
self PVS:AddPVS( Vector position ) Adds a position to a PVS.
self PVS:RemovePVS( Vector position ) Removes a position from a PVS.
self PVS:RemoveLeaf( VisLeaf leaf ) Removes a VisLeaf from a PVS.
Boolean PVS:TestPosition( Vector position ) Returns true if the position is within the PVS.
Table PVS:GetLeafs() Returns a list of all VisLeafs within the PVS.
Boolean PVS:HasLeaf( VisLeaf leaf ) Returns true if the given VisLeaf is within the PVS.

PAS

Returns Functions Description
PAS BSPObject:CreatePAS() Creates an empty PAS
PAS BSPObject:PASForOrigin( Vector position, PAS?) Creates a new or adds a position to a given PAS.
Boolean BSPObject:PASCheck( Vector position, Vector position2 ) Returns true if the two positions is in same PAS.

Returns Functions Description
self PAS:AddPAS( Vector position ) Adds a position to a PAS.
self PAS:RemovePAS( Vector position ) Removes a position from a PAS.
self PAS:RemoveLeaf( VisLeaf leaf ) Removes a VisLeaf from a PAS.
Boolean PAS:TestPosition( Vector position ) Returns true if the position is within the PAS.
Table PAS:GetLeafs() Returns a list of all VisLeafs within the PAS.
Boolean PAS:HasLeaf( VisLeaf leaf ) Returns true if the given VisLeaf is within the PAS.

Nik Naks Wiki


Features:

Clone this wiki locally