Description
The Run
method of the PhysicsTraceBuilder
class executes the configured physics trace and returns the result as a PhysicsTraceResult
. This method is used to perform a physics trace in the game world, which will return the first object that the trace hits.
Usage
To use the Run
method, first configure the PhysicsTraceBuilder
with the desired parameters such as the shape, size, and direction of the trace. Once configured, call the Run
method to execute the trace and obtain the result.
Example
// Example of using the PhysicsTraceBuilder to perform a trace
PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder = traceBuilder.FromTo(startPosition, endPosition);
traceBuilder = traceBuilder.Sphere(radius);
PhysicsTraceResult result = traceBuilder.Run();
if (result.Hit)
{
// Handle the hit result
Entity hitEntity = result.Entity;
Vector3 hitPosition = result.Position;
// Additional logic here
}