Skip to main content

Trace

Static API for VPhys2 ray and shape casting. All methods are no-ops if the physics query system is not yet ready.

public static class Trace

Namespace: DeadworksManaged.Api
Source: Trace/TraceSystem.cs#L6

Methods​

Trace.TraceShape()​

Executes a raw VPhys2 trace using the provided ray shape and filter, writing results into trace.

Signature

public static unsafe void TraceShape(Vector3 start, Vector3 end, Ray_t ray, CTraceFilter filter, ref CGameTrace trace)

Source: Trace/TraceSystem.cs#L12

Trace.SimpleTrace()​

Convenience trace that constructs a CTraceFilter and Ray_t from individual parameters, optionally ignoring up to two entities.

Signature

public static unsafe void SimpleTrace(Vector3 start, Vector3 end, RayType_t rayKind, RnQueryObjectSet objectQuery, InteractionLayer interactWith, InteractionLayer interactExclude, InteractionLayer interactAs, CollisionGroup collision, ref CGameTrace trace, CBaseEntity? filterEntity = null, CBaseEntity? filterSecondEntity = null)

Source: Trace/TraceSystem.cs#L23

Trace.SimpleTraceAngles()​

Like SimpleTrace but takes pitch/yaw angles instead of an end point, projecting maxDistance units forward.

Signature

public static void SimpleTraceAngles(Vector3 start, Vector3 angles, RayType_t rayKind, RnQueryObjectSet objectQuery, InteractionLayer interactWith, InteractionLayer interactExclude, InteractionLayer interactAs, CollisionGroup collision, ref CGameTrace trace, CBaseEntity? filterEntity = null, CBaseEntity? filterSecondEntity = null, float maxDistance = 8192f)

Source: Trace/TraceSystem.cs#L53

Trace.Ray()​

Fires a simple line ray from start to end. Returns a TraceResult with hit position and fraction.

Signature

public static unsafe TraceResult Ray(Vector3 start, Vector3 end, InteractionLayer mask = InteractionLayer.Solid | InteractionLayer.Hitbox, CBaseEntity? ignore = null)

Source: Trace/TraceSystem.cs#L72