SceneTrace Sphere( float radius, Vector3& from, Vector3& to )
SceneTrace Sphere( float radius, Ray& ray, System.Single& distance )

robot_2Generated
code_blocksInput

Description

The Sphere method in the SceneTrace class is used to perform a sphere trace from a starting point to an ending point in the scene. This method is useful for detecting collisions or intersections along the path of the sphere as it moves from the from position to the to position.

Usage

To use the Sphere method, you need to provide the radius of the sphere and the starting and ending positions as Vector3 references. The method will return a SceneTrace object that can be further configured or executed to perform the trace.

Example

// Example of using the Sphere method
Vector3 startPosition = new Vector3(0, 0, 0);
Vector3 endPosition = new Vector3(10, 0, 0);
float sphereRadius = 1.0f;

SceneTrace trace = new SceneTrace();
SceneTrace result = trace.Sphere(sphereRadius, ref startPosition, ref endPosition);

// Further configuration or execution of the trace can be done here
SceneTraceResult traceResult = result.Run();

// Check if the trace hit anything
if (traceResult.Hit)
{
    // Handle the hit result
    Vector3 hitPosition = traceResult.Position;
    // Additional logic here
}