robot_2Generated
code_blocksInput

Description

The Sweep method in the PhysicsTraceBuilder class is used to perform a physics trace by sweeping a physics body from one transform to another. This method is useful for detecting collisions or interactions along a path defined by the movement of a physics body.

Usage

To use the Sweep method, you need to provide a reference to a PhysicsBody and two Transform references representing the start and end positions of the sweep. The method returns a PhysicsTraceBuilder object, allowing for further configuration or execution of the trace.

Example

// Example usage of the Sweep method
PhysicsBody body = new PhysicsBody();
Transform startTransform = new Transform();
Transform endTransform = new Transform();

PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder = traceBuilder.Sweep(ref body, ref startTransform, ref endTransform);

// Further configuration or execution of the trace can be done using traceBuilder
PhysicsTraceResult result = traceBuilder.Run();

// Check the result for any collisions or interactions
if (result.Hit)
{
    // Handle collision
}