book_4_sparkGenerated
code_blocksInput

Description

The Sweep method in the SceneTrace class is used to perform a sweep test with a given PhysicsBody. It sweeps each PhysicsShape of the provided PhysicsBody from a starting transform to an ending transform and returns the closest collision encountered during the sweep. This method does not support mesh-based PhysicsShapes and is similar to performing a hull trace but allows for rotation changes during the sweep.

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 and orientations of the sweep. The method will return a SceneTrace object that contains information about the closest collision detected during the sweep.

Example

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

SceneTrace traceResult = SceneTrace.Sweep(ref myBody, ref startTransform, ref endTransform);

// Process the trace result
if (traceResult != null)
{
    // Handle collision
}