Struct Rubikon.TraceResult ​
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Ray trace hit result with position, normal, and distance.
public record struct Rubikon.TraceResult : IEquatable<Rubikon.TraceResult>Implements ​
IEquatable<Rubikon.TraceResult>
Constructors ​
TraceResult(bool, Vector3, Vector3, float, int) ​
Ray trace hit result with position, normal, and distance.
public TraceResult(bool Hit, Vector3 HitPosition, Vector3 HitNormal, float Distance, int TriangleIndex)Parameters ​
Hit bool
HitPosition Vector3
HitNormal Vector3
Distance float
TriangleIndex int
TraceResult() ​
Initializes a default Rubikon.TraceResult representing a miss at maximum distance.
public TraceResult()Properties ​
ContactPoint ​
Gets or sets the point of contact on the hit surface: for swept box traces, the closest point on the hit triangle to the box center at impact. Rubikon.TraceResult.HitPosition is the swept shape's center.
public Vector3 ContactPoint { readonly get; set; }Property Value ​
Distance ​
public float Distance { readonly get; set; }Property Value ​
float
Hit ​
public bool Hit { readonly get; set; }Property Value ​
bool
HitEntity ​
Gets or sets the entity this hit belongs to, for sweeps that fold brush entities in: the entity whose collider was struck, or the world entity for static world geometry. Null when the sweep did not carry entity identity at all.
public BaseEntity? HitEntity { readonly get; set; }Property Value ​
HitNormal ​
public Vector3 HitNormal { readonly get; set; }Property Value ​
HitPosition ​
public Vector3 HitPosition { readonly get; set; }Property Value ​
IsMinimalDistance ​
Did we hit something very close to the starting position?
public readonly bool IsMinimalDistance { get; }Property Value ​
bool
IsValid ​
Gets or sets whether the trace fired. false when the sweep was rejected as shorter than Rubikon.Epsilon: it reads as a miss but says nothing about the geometry, so do not treat it as validated.
public bool IsValid { readonly get; set; }Property Value ​
bool
StartSolid ​
Gets or sets a value indicating whether the swept shape already overlapped geometry at the start position. When set, Rubikon.TraceResult.Distance is 0 and the reported normal belongs to one arbitrary overlapping triangle.
public bool StartSolid { readonly get; set; }Property Value ​
bool
SurfacePropertyHash ​
Gets or sets the hash of the surface property of the hit triangle or hull, zero when unknown.
public uint SurfacePropertyHash { readonly get; set; }Property Value ​
uint
TriangleIndex ​
public int TriangleIndex { readonly get; set; }Property Value ​
int
Methods ​
MinimizeWith(TraceResult) ​
Updates this Rubikon.TraceResult if the other is closer. Returns true if updated.
public bool MinimizeWith(Rubikon.TraceResult other)Parameters ​
other Rubikon.TraceResult
Returns ​
bool
StopsScanning(bool) ​
Whether shape scanning can stop at this result: the hit is as close as it can get, and if the trace is probing for start-solid, only an actual overlap qualifies - an exact-touch zero-distance hit must not mask an embedded shape tested later.
public readonly bool StopsScanning(bool detectStartSolid)Parameters ​
detectStartSolid bool
Returns ​
bool

