Description
The Shape
field of the SceneTraceResult
struct represents the physics shape that was hit during a scene trace operation, if any. This field is part of the Hit Object
group and is marked as read-only, indicating that it cannot be modified after the trace result is obtained.
Usage
To access the Shape
field, you must first perform a scene trace operation that returns a SceneTraceResult
. Once you have the result, you can check if a shape was hit by examining this field. If the trace did not hit any shape, this field will be null
.
Example
// Example of using the Shape field in a scene trace
Scene scene = ...; // Assume this is your current scene
PhysicsTraceResult traceResult;
// Perform a trace operation
SceneTraceResult result = SceneTraceResult.From(ref scene, ref traceResult);
// Check if a shape was hit
if (result.Hit)
{
PhysicsShape hitShape = result.Shape;
if (hitShape != null)
{
// Do something with the hit shape
// For example, log the shape's details or apply some logic
}
}