robot_2Generated
code_blocksInput

Description

The Sweep method in the SceneTrace class is used to perform a sweep test with a given PhysicsBody. This method sweeps each PhysicsShape of the provided PhysicsBody from a starting transform to an ending transform, returning the closest collision encountered during the sweep. It is important to note that this method does not support mesh-based PhysicsShapes. The sweep allows for rotation changes during the process, making it similar to a hull trace but with the added capability of handling physics shapes.

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 body = new PhysicsBody();
Transform startTransform = new Transform();
Transform endTransform = new Transform();

SceneTrace trace = new SceneTrace();
SceneTrace result = trace.Sweep(ref body, ref startTransform, ref endTransform);

// Process the result to handle the collision
if (result != null)
{
    // Handle collision
}