book_4_sparkGenerated
code_blocksInput

Description

The Shape field in the SceneTraceResult struct represents the physics shape that was hit during a trace operation, if any. This field is part of the Hit Object group and is marked as read-only, indicating that it is intended to be used for retrieving information about the trace result rather than being modified directly.

Usage

Use the Shape field to access the specific PhysicsShape that was intersected during a trace. This can be useful for determining the exact part of a physics object that was hit, allowing for more detailed collision handling or response logic.

Example

// Example of using the Shape field in a trace result
SceneTraceResult traceResult = SceneTraceResult.From(scene, ref physicsTraceResult);

if (traceResult.Hit)
{
    PhysicsShape hitShape = traceResult.Shape;
    // Perform operations with the hitShape
    // For example, logging the shape type
    Log.Info($"Hit shape type: {hitShape.GetType()}");
}