TraceResult
Struct TraceResult
Namespace: SwiftlyS2.Shared.Trace
Assembly: SwiftlyS2.CS2.dll
public struct TraceResultInherited Members
- object.Equals(object?)
- object.Equals(object?, object?)
- object.GetHashCode()
- object.GetType()
- object.ReferenceEquals(object?, object?)
- object.ToString()
Constructors
TraceResult()
public TraceResult()Properties
BodyTransform
The transformation matrix of the body that was hit.
public readonly CTransform BodyTransform { get; }Contents
The contents mask of the surface or volume that was hit.
public readonly ulong Contents { get; }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; }Direction
Calculates the normalized direction vector of the trace from start to end.
public Vector Direction { get; }Distance
Calculates the total distance traveled from the start position to the end position.
public float Distance { get; }EndPos
The ending position of the trace.
public readonly Vector EndPos { get; }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; }ExactHitPoint
Indicates whether the exact hit point was calculated for this trace result.
public readonly bool ExactHitPoint { get; }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; }HitBox
Information about the hitbox that was hit by the trace, if applicable.
public readonly HitBoxTrace? HitBox { get; }HitNormal
The surface normal of the point where the trace hit.
public readonly Vector HitNormal { get; }HitOffset
The distance from the trace start position to the hit point along the trace direction.
public readonly float HitOffset { get; }HitPoint
The exact point in 3D space where the trace hit a surface or entity.
public readonly Vector HitPoint { get; }HitboxBoneIndex
The bone index of the hitbox that was hit, if applicable.
public readonly short HitboxBoneIndex { get; }RayType
The type of ray that was used for this trace.
public readonly RayType_t RayType { get; }ShapeAttributes
The collision attributes of the shape that was hit.
public readonly TraceCollisionAttributes ShapeAttributes { get; }StartInSolid
Indicates whether the starting position of the trace was already inside a solid object.
public readonly bool StartInSolid { get; }StartPos
The starting position of the trace.
public readonly Vector StartPos { get; }SurfaceProperties
The physical surface properties of the surface that was hit by the trace.
public readonly PhysSurfacePropertiesTrace? SurfaceProperties { get; }Triangle
The triangle index of the surface that was hit, if applicable.
public readonly int Triangle { get; }Methods
HitEntity<T>(out T?)
public bool HitEntity<T>(out T? entity) where T : class, ISchemaClass<T>- entity T?
- T
HitEntity<T>()
public bool HitEntity<T>() where T : class, ISchemaClass<T>- 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>- designerName string
- outEntity T?
- matchType NameMatchType
- T
HitEntityByDesignerName<T>(string, NameMatchType)
public bool HitEntityByDesignerName<T>(string designerName, NameMatchType matchType = NameMatchType.StartsWith) where T : class, ISchemaClass<T>- designerName string
- matchType NameMatchType
- T
HitPlayer(out IPlayer?)
public bool HitPlayer(out IPlayer? player)- player IPlayer?
HitPlayer()
public bool HitPlayer()ToString()
Returns the fully qualified type name of this instance.
public override string ToString()- string — The fully qualified type name.