Garry's Mod Wiki

TraceResult

Description

Table structure used as trace result. Default values are when the trace hits nothing.

Parameters

Entity [Entity]

The entity hit by the trace.

Default: NULL

Fraction [number]

This indicates the how much of your trace length was used from 0-1 (resultLength/originalLength).

Default: 1

FractionLeftSolid [number]

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.

Default: 0

Hit [boolean]

Indicates whether the trace hit something.

Default: false

HitBox [number]

The ID of the hitbox hit by the trace.

Default: 0

HitGroup [number]

Enums/HITGROUP describing what hitgroup the trace hit (not the same as HitBox).

Default: 0

HitNoDraw [boolean]

Indicates whenever the trace hit a no-draw brush.

Default: false

HitNonWorld [boolean]

Indicates whenever the trace did not hit the world.

Default: false

HitNormal [Vector]

The direction of the surface that was hit as a normal vector (vector with length of 1).

Default: Global.Vector(0, 0, 0)

HitPos [Vector]

The position the trace stopped. This will be the provided endpos if the trace hit nothing.

HitSky [boolean]

Indicates whenever the trace hit the sky.

Default: false

HitTexture [string]

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.

Default: "** empty **"

HitWorld [boolean]

Indicates whenever the trace hit the world.

Default: false

MatType [number]

Enums/MAT of the material hit by the trace.

Default: 0

Normal [Vector]

The direction of the trace as a normal vector (vector with length of 1).

PhysicsBone [number]

The PhysObj ID that was hit.

Used for Entity:GetPhysicsObjectNum.

Default: 0

StartPos [Vector]

The origin of the trace. Will match the provided startpos.

SurfaceProps [number]

ID of hit surface property from scripts/surfaceproperties.txt. You can get the name using util.GetSurfacePropName.

Used for CEffectData:SetSurfaceProp.

Default: 0

StartSolid [boolean]

Indicates whenever the trace started in a solid enviroment.

Default: false

AllSolid [boolean]

True if the entire trace is inside a solid.

Default: false

SurfaceFlags [number]

The surface flags of the hit surface. See Enums/SURF.

Default: 0

DispFlags [number]

The displacement flags of the hit surface. See Enums/DISPSURF.

Default: 0

Contents [number]

The contents of the hit surface. See Enums/CONTENTS.

Page Links


Special Pages


Wikis

?

Render Time: 70ms

DB GetPage 3
Generate Html 42
SaveChanges (1) 9
Render Body 0
Render Sidebar 12