Description
The Shape
field in the PhysicsTraceResult
struct represents the specific physics shape that was hit during a physics trace operation, if any. This field is of type PhysicsShape
, which encapsulates the geometric and physical properties of the shape involved in the collision.
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 field is not null, it indicates that a shape was indeed hit during the trace.
Example
// Example of using the Shape field in a PhysicsTraceResult
// Assume we have a PhysicsTraceResult from a trace operation
PhysicsTraceResult traceResult = PerformPhysicsTrace();
// Check if a shape was hit
if (traceResult.Hit)
{
PhysicsShape hitShape = traceResult.Shape;
if (hitShape != null)
{
// Do something with the hit shape
// For example, log its properties or apply some logic
Log.Info($"Hit shape: {hitShape}");
}
}