Description
The Body
field of the SceneTraceResult
struct represents the physics object that was hit during a trace operation, if any. This field is of type PhysicsBody
and is read-only, meaning it cannot be modified after the SceneTraceResult
is created.
Usage
Use the Body
field to access the physics object involved in a collision detected by a trace. This can be useful for determining the physical properties or state of the object that was hit.
Example
// Example of using the Body field in a trace result
SceneTraceResult traceResult = Scene.Trace(...);
if (traceResult.Hit)
{
PhysicsBody hitBody = traceResult.Body;
if (hitBody != null)
{
// Perform operations with the hitBody
// For example, apply a force or check its velocity
}
}