robot_2Generated
code_blocksInput

Description

The RunTrace method in the PhysicsWorld class is used to execute a physics trace using a specified PhysicsTraceBuilder. This method returns a PhysicsTraceResult which contains information about the trace, such as whether it hit an object, the position of the hit, and other relevant details.

Usage

To use the RunTrace method, you need to have a PhysicsTraceBuilder object that defines the parameters of the trace, such as the start and end points, the collision mask, and any other relevant settings. You pass this builder to the RunTrace method by reference, and it returns a PhysicsTraceResult that you can use to determine the outcome of the trace.

Example

// Create a PhysicsTraceBuilder
PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder.Start = new Vector3(0, 0, 0);
traceBuilder.End = new Vector3(10, 0, 0);
traceBuilder.CollisionMask = CollisionLayer.Solid;

// Run the trace
PhysicsTraceResult result = physicsWorld.RunTrace(ref traceBuilder);

// Check if the trace hit something
if (result.Hit)
{
    // Output the position of the hit
    Vector3 hitPosition = result.Position;
    // Handle the hit event
}