Description
The FromTo
method in the SceneTrace
struct is used to set the start and end positions of a trace request. This method is essential for defining the path along which the trace will be conducted, allowing you to specify the exact points in 3D space that the trace should begin and end.
Usage
To use the FromTo
method, you need to provide two Vector3
references representing the start and end positions of the trace. This method modifies the trace configuration to use these positions when the trace is executed.
Example
// Example usage of the FromTo method
Vector3 startPosition = new Vector3(0, 0, 0);
Vector3 endPosition = new Vector3(10, 0, 0);
SceneTrace trace = new SceneTrace();
trace.FromTo(ref startPosition, ref endPosition);
// Run the trace
SceneTraceResult result = trace.Run();
// Check if the trace hit something
if (result.Hit)
{
// Handle the hit
var hitPosition = result.Position;
// Do something with the hit position
}