Garry's Mod Wiki

Revision Difference

Structures/TraceResult#517026

<cat>struct</cat> <structure> <description>Table structure used as trace result. Default values are when the trace hits nothing.</description> <fields>{{StructureField|Entity|Entity|The entity hit by the trace.|NULL</fields> </structure> {{StructureField|number|Fraction|This indicates the how much of your trace length was used from 0-1 (resultLength/originalLength).|1}}{{StructureField|number|FractionLeftSolid|Given the trace started in a solid enviroment, this will return at what distance the trace left the solid from 0-1. Doesn't work if the trace hit a non-worldspawn entity.|0}}{{StructureField|boolean|Hit|Indicates whether the trace hit something.|false}}{{StructureField|number|HitBox|The ID of the hitbox hit by the trace.|0}}{{StructureField|number|HitGroup|<page>HITGROUP</page> describing what hitgroup the trace hit (not the same as HitBox).|0}}{{StructureField|boolean|HitNoDraw|Indicates whenever the trace hit a no-draw brush.|false}}{{StructureField|boolean|HitNonWorld|Indicates whenever the trace did not hit the world.|false}}{{StructureField|Vector|HitNormal|The direction of the surface that was hit as a normal vector (vector with [length](/gmod/Vector/Length) of 1).|<page>Global.Vector</page>(0, 0, 0)}}{{StructureField|Vector|HitPos|The position the trace stopped. This will be the provided endpos if the trace hit nothing.}}{{StructureField|boolean|HitSky|Indicates whenever the trace hit the sky.|false}}{{StructureField|string|HitTexture|The surface material (not texture) of whatever the trace hit. Will be "**displacement**" if the trace hit a displacement, and **studio** if it hit a prop.|"**empty**"}}{{StructureField|boolean|HitWorld|Indicates whenever the trace hit the world.|false}}{{StructureField|number|MatType|<page>MAT</page> of the material hit by the trace.|0}}{{StructureField|Vector|Normal|The direction of the trace as a normal vector (vector with [length](/gmod/Vector/Length) of 1).}}{{StructureField|number|PhysicsBone|The <page>PhysObj</page> ID that was hit. {{StructureField|number|Fraction|This indicates the how much of your trace length was used from 0-1 (resultLength/originalLength).|1}}{{StructureField|number|FractionLeftSolid|Given the trace started in a solid enviroment, this will return at what distance the trace left the solid from 0-1. Doesn't work if the trace hit a non-worldspawn entity.|0}}{{StructureField|boolean|Hit|Indicates whether the trace hit something.|false}}{{StructureField|number|HitBox|The ID of the hitbox hit by the trace.|0}}{{StructureField|number|HitGroup|<page>HITGROUP</page> describing what hitgroup the trace hit (not the same as HitBox).|0}}{{StructureField|boolean|HitNoDraw|Indicates whenever the trace hit a no-draw brush.|false}}{{StructureField|boolean|HitNonWorld|Indicates whenever the trace did not hit the world.|false}}{{StructureField|Vector|HitNormal|The direction of the surface that was hit as a normal vector (vector with [length](/gmod/Vector/Length) of 1).|<page>Global.Vector</page>(0, 0, 0)}}<item name="HitPos" type="Vector">The position the trace stopped. This will be the provided endpos if the trace hit nothing.</item> {{StructureField|boolean|HitSky|Indicates whenever the trace hit the sky.|false}}{{StructureField|string|HitTexture|The surface material (not texture) of whatever the trace hit. Will be "**displacement**" if the trace hit a displacement, and **studio** if it hit a prop.|"**empty**"}}{{StructureField|boolean|HitWorld|Indicates whenever the trace hit the world.|false}}{{StructureField|number|MatType|<page>MAT</page> of the material hit by the trace.|0}}<item name="Normal" type="Vector">The direction of the trace as a normal vector (vector with [length](/gmod/Vector/Length) of 1).</item> {{StructureField|number|PhysicsBone|The <page>PhysObj</page> ID that was hit. Used for <page>Entity:GetPhysicsObjectNum</page>.|0 }}{{StructureField|Vector|StartPos|The origin of the trace. Will match the provided startpos.}}{{StructureField|number|SurfaceProps|ID of hit surface property from scripts/surfaceproperties.txt. }}<item name="StartPos" type="Vector">The origin of the trace. Will match the provided startpos.</item> {{StructureField|number|SurfaceProps|ID of hit surface property from scripts/surfaceproperties.txt. You can get the name using <page>util.GetSurfacePropName</page>. Used for <page>CEffectData:SetSurfaceProp</page>.|0 }}{{StructureField|boolean|StartSolid|Indicates whenever the trace started in a solid enviroment.|false}}{{StructureField|boolean|AllSolid|True if the entire trace is inside a solid.|false}}{{StructureField|number|SurfaceFlags|The surface flags of the hit surface. See <page>SURF</page>.|0}}{{StructureField|number|DispFlags|The displacement flags of the hit surface. See <page>DISPSURF</page>.|0}}{{StructureField|number|Contents|The contents of the hit surface. See <page>CONTENTS</page>.}} }}}}{{StructureField|boolean|StartSolid|Indicates whenever the trace started in a solid enviroment.|false}}{{StructureField|boolean|AllSolid|True if the entire trace is inside a solid.|false}}{{StructureField|number|SurfaceFlags|The surface flags of the hit surface. See <page>SURF</page>.|0}}{{StructureField|number|DispFlags|The displacement flags of the hit surface. See <page>DISPSURF</page>.|0}}<item name="Contents" type="number">The contents of the hit surface. See <page>CONTENTS</page>.</item> }}