util.PointContents
Description
Returns the contents of the position specified.
This function will sample only the world environments. It can be used to check if Entity:GetPos is underwater for example unlike Entity:WaterLevel which works for players only.
Arguments
Returns
Example
Check if the trace position is underwater.
Example
Check if the trace entity position is underwater assuming the object is already valid.
if ( bit.band( util.PointContents( tr.Entity:GetPos() ), CONTENTS_WATER ) == CONTENTS_WATER ) then
-- Do stuff here when the entity's position is underwater.
end