Description
The FromTo
method in the PhysicsTraceBuilder
class is used to define a trace from a starting point to an ending point in 3D space. This method sets up the trace to begin at the specified from
position and end at the to
position, allowing for collision detection or other physics-based interactions along the path.
Usage
To use the FromTo
method, you need to provide two Vector3
references representing the start and end points of the trace. This method is typically used in conjunction with other methods of the PhysicsTraceBuilder
to configure the trace before executing it with Run
or RunAll
.
Example
// Example usage of the FromTo method
Vector3 start = new Vector3(0, 0, 0);
Vector3 end = new Vector3(10, 0, 0);
PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder.FromTo(ref start, ref end);
// Configure additional trace settings if needed
traceBuilder.HitTriggers();
// Execute the trace
PhysicsTraceResult result = traceBuilder.Run();
// Check if the trace hit something
if (result.Hit)
{
// Handle the hit result
var hitPosition = result.Position;
// Additional logic here
}