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 usage:
PhysicsTraceResult result = Physics.TraceRay(startPosition, endPosition);
if (result.Hit)
{
PhysicsBody hitBody = result.Body;
// Perform operations with hitBody
}
Example
PhysicsTraceResult result = Physics.TraceRay(startPosition, endPosition);
if (result.Hit)
{
PhysicsBody hitBody = result.Body;
// Perform operations with hitBody
}