Description
The Body
field of the PhysicsTraceResult
struct represents the physics object that was hit during a trace operation, if any. This field is of type PhysicsBody
and provides access to the physical properties and behaviors of the object that was intersected by the trace.
Usage
To use the Body
field, you typically perform a physics trace and then check the Hit
field of the PhysicsTraceResult
to determine if a collision occurred. If Hit
is true
, you can access the Body
field to interact with the physics object that was hit.
Example
// Example of using PhysicsTraceResult.Body
PhysicsTraceResult traceResult = PerformPhysicsTrace();
if (traceResult.Hit)
{
PhysicsBody hitBody = traceResult.Body;
if (hitBody != null)
{
// Perform operations with the hitBody
// For example, apply a force or retrieve its properties
}
}