The Collider
field in the SceneTraceResult
struct represents the Collider
that was hit during a scene trace operation. This field is read-only and provides information about the specific collider that was intersected by the trace.
The Collider
field in the SceneTraceResult
struct represents the Collider
that was hit during a scene trace operation. This field is read-only and provides information about the specific collider that was intersected by the trace.
To access the Collider
field, you must first perform a scene trace operation that returns a SceneTraceResult
object. Once you have this result, you can access the Collider
field to determine which collider was hit.
// Example of using SceneTraceResult to get the Collider Scene scene = ...; // Assume this is your current scene PhysicsTraceResult physicsResult = ...; // Assume this is obtained from a physics trace SceneTraceResult traceResult = SceneTraceResult.From(ref scene, ref physicsResult); if (traceResult.Hit) { Collider hitCollider = traceResult.Collider; // Use hitCollider as needed }