SwiftlyS2

TraceResult

Struct TraceResult

Namespace: SwiftlyS2.Shared.Trace

Assembly: SwiftlyS2.CS2.dll

public struct TraceResult

Inherited Members

Constructors

TraceResult()

public TraceResult()

Properties

BodyTransform

The transformation matrix of the body that was hit.

public readonly CTransform BodyTransform { get; }
Property Value

Contents

The contents mask of the surface or volume that was hit.

public readonly ulong Contents { get; }
Property Value

DidHit

Returns true if the trace hit something (either the trace fraction is less than 1.0 or the start position was in solid).

public bool DidHit { get; }
Property Value

Direction

Calculates the normalized direction vector of the trace from start to end.

public Vector Direction { get; }
Property Value

Distance

Calculates the total distance traveled from the start position to the end position.

public float Distance { get; }
Property Value

EndPos

The ending position of the trace.

public readonly Vector EndPos { get; }
Property Value

Entity

The entity that was hit by the trace, if applicable. Null if nothing or a static surface was hit.

public readonly CEntityInstance? Entity { get; }
Property Value

ExactHitPoint

Indicates whether the exact hit point was calculated for this trace result.

public readonly bool ExactHitPoint { get; }
Property Value

Fraction

The fraction of the trace distance traveled before hitting something (0.0 = start, 1.0 = end, > 1.0 = no hit).

public readonly float Fraction { get; }
Property Value

HitBox

Information about the hitbox that was hit by the trace, if applicable.

public readonly HitBoxTrace? HitBox { get; }
Property Value

HitNormal

The surface normal of the point where the trace hit.

public readonly Vector HitNormal { get; }
Property Value

HitOffset

The distance from the trace start position to the hit point along the trace direction.

public readonly float HitOffset { get; }
Property Value

HitPoint

The exact point in 3D space where the trace hit a surface or entity.

public readonly Vector HitPoint { get; }
Property Value

HitboxBoneIndex

The bone index of the hitbox that was hit, if applicable.

public readonly short HitboxBoneIndex { get; }
Property Value

RayType

The type of ray that was used for this trace.

public readonly RayType_t RayType { get; }
Property Value

ShapeAttributes

The collision attributes of the shape that was hit.

public readonly TraceCollisionAttributes ShapeAttributes { get; }
Property Value

StartInSolid

Indicates whether the starting position of the trace was already inside a solid object.

public readonly bool StartInSolid { get; }
Property Value

StartPos

The starting position of the trace.

public readonly Vector StartPos { get; }
Property Value

SurfaceProperties

The physical surface properties of the surface that was hit by the trace.

public readonly PhysSurfacePropertiesTrace? SurfaceProperties { get; }
Property Value

Triangle

The triangle index of the surface that was hit, if applicable.

public readonly int Triangle { get; }
Property Value

Methods

HitEntity<T>(out T?)

public bool HitEntity<T>(out T? entity) where T : class, ISchemaClass<T>
Parameters
  • entity T?
Returns
Type Parameters
  • T

HitEntity<T>()

public bool HitEntity<T>() where T : class, ISchemaClass<T>
Returns
Type Parameters
  • T

HitEntityByDesignerName<T>(string, out T?, NameMatchType)

public bool HitEntityByDesignerName<T>(string designerName, out T? outEntity, NameMatchType matchType = NameMatchType.StartsWith) where T : class, ISchemaClass<T>
Parameters
Returns
Type Parameters
  • T

HitEntityByDesignerName<T>(string, NameMatchType)

public bool HitEntityByDesignerName<T>(string designerName, NameMatchType matchType = NameMatchType.StartsWith) where T : class, ISchemaClass<T>
Parameters
Returns
Type Parameters
  • T

HitPlayer(out IPlayer?)

public bool HitPlayer(out IPlayer? player)
Parameters
Returns

HitPlayer()

public bool HitPlayer()
Returns

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()
Returns
  • string — The fully qualified type name.

On this page