util.PointContents

From GMod Wiki

Revision as of 02:43, 21 January 2010 by Haza (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax util.PointContents( Vector position )
Where is this used?
Description:
Checks the contents at the position given, based on a position enumeration
Returns: Enum contents
Part of Library: Util
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Util.PointContents]Util.PointContents [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionOnly runs code if ent is in water
Used onNewerShared.png
Code
local contents = util.PointContents( ent:GetPos() )
 if( contents == CONTENTS_TRANSLUCENT ) or ( contents == CONTENTS_WATER ) then -- Being in water usually returns CONTENTS_TRANSLUCENT.
  //code here
 end
OutputN/A


Additional Notes

These are the available contents:

SHARED | 0000000000000000 | 00000000000000000000000000000000 | CONTENTS_EMPTY
SHARED | 0000000000000001 | 00000000000000000000000000000001 | CONTENTS_SOLID
SHARED | 0000000000000002 | 00000000000000000000000000000010 | CONTENTS_WINDOW
SHARED | 0000000000000004 | 00000000000000000000000000000100 | CONTENTS_AUX
SHARED | 0000000000000008 | 00000000000000000000000000001000 | CONTENTS_GRATE
SHARED | 0000000000000016 | 00000000000000000000000000010000 | CONTENTS_SLIME
SHARED | 0000000000000032 | 00000000000000000000000000100000 | CONTENTS_WATER
SHARED | 0000000000000064 | 00000000000000000000000001000000 | CONTENTS_BLOCKLOS
SHARED | 0000000000000128 | 00000000000000000000000010000000 | CONTENTS_OPAQUE
SHARED | 0000000000000256 | 00000000000000000000000100000000 | CONTENTS_TESTFOGVOLUME
SHARED | 0000000000000512 | 00000000000000000000001000000000 | CONTENTS_TEAM4
SHARED | 0000000000001024 | 00000000000000000000010000000000 | CONTENTS_TEAM3
SHARED | 0000000000002048 | 00000000000000000000100000000000 | CONTENTS_TEAM1
SHARED | 0000000000004096 | 00000000000000000001000000000000 | CONTENTS_TEAM2
SHARED | 0000000000008192 | 00000000000000000010000000000000 | CONTENTS_IGNORE_NODRAW_OPAQUE
SHARED | 0000000000016384 | 00000000000000000100000000000000 | CONTENTS_MOVEABLE
SHARED | 0000000000032768 | 00000000000000001000000000000000 | CONTENTS_AREAPORTAL
SHARED | 0000000000065536 | 00000000000000010000000000000000 | CONTENTS_PLAYERCLIP
SHARED | 0000000000131072 | 00000000000000100000000000000000 | CONTENTS_MONSTERCLIP
SHARED | 0000000000262144 | 00000000000001000000000000000000 | CONTENTS_CURRENT_0
SHARED | 0000000000524288 | 00000000000010000000000000000000 | CONTENTS_CURRENT_90
SHARED | 0000000001048576 | 00000000000100000000000000000000 | CONTENTS_CURRENT_180
SHARED | 0000000002097152 | 00000000001000000000000000000000 | CONTENTS_CURRENT_270
SHARED | 0000000004194304 | 00000000010000000000000000000000 | CONTENTS_CURRENT_UP
SHARED | 0000000008388608 | 00000000100000000000000000000000 | CONTENTS_CURRENT_DOWN
SHARED | 0000000016777216 | 00000001000000000000000000000000 | CONTENTS_ORIGIN
SHARED | 0000000033554432 | 00000010000000000000000000000000 | CONTENTS_MONSTER
SHARED | 0000000067108864 | 00000100000000000000000000000000 | CONTENTS_DEBRIS
SHARED | 0000000134217728 | 00001000000000000000000000000000 | CONTENTS_DETAIL
SHARED | 0000000268435456 | 00010000000000000000000000000000 | CONTENTS_TRANSLUCENT
SHARED | 0000000536870912 | 00100000000000000000000000000000 | CONTENTS_LADDER
SHARED | 0000001073741824 | 01000000000000000000000000000000 | CONTENTS_HITBOX
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox