robot_2Generated
code_blocksInput

Description

The Shape field in the PhysicsTraceResult struct represents the physics shape that was hit during a trace operation, if any. This field is of type PhysicsShape and provides information about the specific shape involved in the collision or intersection detected by the trace.

Usage

To access the Shape field, you need to perform a physics trace operation that returns a PhysicsTraceResult object. Once you have this result, you can check if a shape was hit by examining the Shape field. If the trace did not hit any shape, this field will be null.

Example

// Example of using the Shape field in a PhysicsTraceResult
PhysicsTraceResult traceResult = Physics.TraceRay(startPosition, endPosition);

if (traceResult.Hit)
{
    PhysicsShape hitShape = traceResult.Shape;
    if (hitShape != null)
    {
        // Process the hit shape
        // For example, log the shape's details or apply some logic based on the shape
    }
}