Limited support
This feature is only present in Portal 2: Community Edition and Portal: Revolution.

CGameTrace

DidHit

Returns true if the trace hit anything.

bool CGameTrace::DidHit()

DidHitNonWorldEntity

Returns true if the trace hit non-world entity.

bool CGameTrace::DidHitNonWorldEntity()

DidHitWorld

Returns true if trace hit world.

bool CGameTrace::DidHitWorld()

EntirelyColliding

Returns true if the trace was entirely inside a solid object.

bool CGameTrace::EntirelyColliding()

GetContents

Returns the contents flags of the hit entity or surface.

int CGameTrace::GetContents()

GetEndPos

Returns the impact position of the trace.

Vector CGameTrace::GetEndPos()

GetEntity

Returns a handle to the entity this trace hit.

handle CGameTrace::GetEntity()

GetEntityIndex

Returns the index of the entity hit, or -1 if it did not hit an entity.

int CGameTrace::GetEntityIndex()

GetExitFraction

If StartsColliding() is true, this is the fraction at which the trace exited the starting solid object.

float CGameTrace::GetExitFraction()

GetFraction

Time completed, 1.0 means no hit.

float CGameTrace::GetFraction()

GetImpactNormal

Returns the normal of the plane where the trace hit.

Vector CGameTrace::GetImpactNormal()

GetPaintType

If the impact succeeded, calculate the paint type at the impact point.

int CGameTrace::GetPaintType()

GetStartPos

Returns the start position of the trace. If StartsColliding() is true, this is the position where the trace exited the starting solid object.

Vector CGameTrace::GetStartPos()

GetSurfaceFlags

Returns the surface flags of the hit surface.

int CGameTrace::GetSurfaceFlags()

GetSurfaceName

Returns the material of the hit surface for brushes. **studio** is always returned for props, and **empty** if no impact occurred.

string CGameTrace::GetSurfaceName()

GetSurfaceProp

Returns the $surfaceprop name of the hit surface.

string CGameTrace::GetSurfaceProp()

IsPortalable

Calculate whether this surface is portalable, taking the material and Conversion Gel into account.

int CGameTrace::IsPortalable()

StartsColliding

Returns true if the initial position was inside a solid object.

bool CGameTrace::StartsColliding()