Table of Contents

Class Trace

Namespace
CounterStrikeSharp.API.Modules.Utils
Assembly
CounterStrikeSharp.API.dll

Static class for performing ray and hull traces against the game world.

public static class Trace
Inheritance
object
Trace

Methods

CheckAreaOverlappingEntity(CCSNavArea, CBaseEntity, bool)

Returns whether a nav area overlaps with an entity's bounding box. area is an opaque pointer to a CNavArea obtained from the nav system.

[Experimental("CS0001", Message = "CheckAreaOverlappingEntity maps to a Valve function but its behaviour has not been fully understood. Use with caution.")]
public static bool CheckAreaOverlappingEntity(CCSNavArea area, CBaseEntity entity, bool extrudeHullHeight = false)

Parameters

area CCSNavArea
entity CBaseEntity
extrudeHullHeight bool

Returns

bool

GetEntityWorldSpaceAABB(CBaseEntity, out Vector, out Vector)

Returns the world-space axis-aligned bounding box of entity.

public static void GetEntityWorldSpaceAABB(CBaseEntity entity, out Vector mins, out Vector maxs)

Parameters

entity CBaseEntity
mins Vector
maxs Vector

PointContents(Vector, Contents)

Returns the contents bitmask at the given world position.

[Experimental("CS0001", Message = "PointContents maps to a Valve function but its behaviour has not been fully understood. Use with caution.")]
public static Contents PointContents(Vector pos, Contents contentsMask = Contents.Empty)

Parameters

pos Vector
contentsMask Contents

Returns

Contents

TraceEndShape(Vector, Vector, CBaseEntity?, TraceOptions?)

Performs a line trace between two world-space points.

public static TraceResult TraceEndShape(Vector startPos, Vector endPos, CBaseEntity? ignoreEntity = null, TraceOptions? options = null)

Parameters

startPos Vector
endPos Vector
ignoreEntity CBaseEntity
options TraceOptions

Returns

TraceResult

TraceHullShape(Vector, Vector, Vector, Vector, CBaseEntity?, TraceOptions?)

Performs a hull (box) trace between two world-space points.

public static TraceResult TraceHullShape(Vector startPos, Vector endPos, Vector mins, Vector maxs, CBaseEntity? ignoreEntity = null, TraceOptions? options = null)

Parameters

startPos Vector
endPos Vector
mins Vector
maxs Vector
ignoreEntity CBaseEntity
options TraceOptions

Returns

TraceResult

TraceShape(Vector, QAngle, CBaseEntity?, TraceOptions?)

Performs a line trace from startPos in the direction of angles for up to 8192 units.

public static TraceResult TraceShape(Vector startPos, QAngle angles, CBaseEntity? ignoreEntity = null, TraceOptions? options = null)

Parameters

startPos Vector
angles QAngle
ignoreEntity CBaseEntity
options TraceOptions

Returns

TraceResult