Trace
From GMod Wiki
Members
Type | Name | Description |
---|---|---|
Vector | start | The place the trace should start from. |
Vector | endpos | The place the trace should stop at. |
Entity OR Table :Entity | filter | (Optional) Entity or Entities to ignore in the trace |
Integer | mask | (Optional) A bitmask stating what the trace should hit. See below |
Example
Bitmasks
Using masks, clever traces can be set up. For instance, this mask will allow the trace to see through windows.
CONTENTS_SOLID + CONTENTS_MOVEABLE + CONTENTS_OPAQUE + CONTENTS_DEBRIS + CONTENTS_HITBOX + CONTENTS_MONSTER
Below are various lists of pre-defined masks and CONTENT_ enumerations that can be used to make your own.
MASK_
SHARED | 0000000000000048 | 0000000000000000000000000000110000 | MASK_SPLITAREAPORTAL SHARED | 0000000000016395 | 0000000000000000000100000000001011 | MASK_SOLID_BRUSHONLY -- Everything normally solid, except monsters(world + brush only). SHARED | 0000000000016432 | 0000000000000000000100000000110000 | MASK_WATER -- Water physics in these contents. SHARED | 0000000000016449 | 0000000000000000000100000001000001 | MASK_BLOCKLOS -- Everything that blocks line of sight for AI. SHARED | 0000000000016513 | 0000000000000000000100000010000001 | MASK_OPAQUE -- Everything that blocks lighting. SHARED | 0000000000024705 | 0000000000000000000110000010000001 | MASK_VISIBLE -- Everything that blocks line of sight for players. SHARED | 0000000000065547 | 0000000000000000010000000000001011 | MASK_DEADSOLID -- Everything that blocks corpse movement. UNDONE: Not used yet / may be deleted. SHARED | 0000000000081931 | 0000000000000000010100000000001011 | MASK_PLAYERSOLID_BRUSHONLY -- Everything normally solid for player movement, except monsters(world + brush only). SHARED | 0000000000131083 | 0000000000000000100000000000001011 | MASK_NPCWORLDSTATIC -- Just the world, used for route rebuilding. SHARED | 0000000000147467 | 0000000000000000100100000000001011 | MASK_NPCSOLID_BRUSHONLY -- Everything normally solid for npc movement, except monsters(world + brush only). SHARED | 0000000016515072 | 0000000000111111000000000000000000 | MASK_CURRENT -- UNDONE: This is untested, any moving water. SHARED | 0000000033570819 | 0000000010000000000100000000000011 | MASK_SHOT_PORTAL -- Hits solids (not grates) and passes through everything else. SHARED | 0000000033570827 | 0000000010000000000100000000001011 | MASK_SOLID -- Everything that is normally solid. SHARED | 0000000033570881 | 0000000010000000000100000001000001 | MASK_BLOCKLOS_AND_NPCS -- Everything that blocks line of sight for AI plus NPCs. SHARED | 0000000033570945 | 0000000010000000000100000010000001 | MASK_OPAQUE_AND_NPCS -- Everything that blocks lighting, but with monsters added. SHARED | 0000000033579137 | 0000000010000000000110000010000001 | MASK_VISIBLE_AND_NPCS -- Everything that blocks line of sight for players, but with monsters added. SHARED | 0000000033636363 | 0000000010000000010100000000001011 | MASK_PLAYERSOLID -- Everything that blocks player movement. SHARED | 0000000033701899 | 0000000010000000100100000000001011 | MASK_NPCSOLID -- Blocks npc movement. SHARED | 0000000100679691 | 0000000110000000000100000000001011 | MASK_SHOT_HULL -- Non-raycasted weapons see this as solid(includes grates). SHARED | 0000001174421507 | 0001000110000000000100000000000011 | MASK_SHOT -- Bullets see these as solid. SHARED | -0000002147483648 | 0000000000000000000000000000000000 | MASK_ALL
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
This page needs to be edited as it contains information that is unclear or incorrect. Improvement can be discussed on the talk page. Find more pages that need work here. Details: None given. |