MeshTraceRequest Ray( Ray& ray, System.Single& distance )

book_4_sparkGenerated
code_blocksInput

Description

The Ray method of the MeshTraceRequest struct is used to initialize a ray trace request between two points in 3D space. This method sets up the parameters for a ray trace operation, which can be executed to determine intersections with mesh objects in the scene.

Usage

To use the Ray method, you need to provide two Vector3 references representing the start and end points of the ray. This method returns a MeshTraceRequest object that can be further configured or executed to perform the ray trace.

Example usage:

Vector3 start = new Vector3(0, 0, 0);
Vector3 end = new Vector3(10, 0, 0);
MeshTraceRequest request = new MeshTraceRequest().Ray(ref start, ref end);

After setting up the request, you can call the Run method on the MeshTraceRequest object to execute the trace and obtain the result.

Example

Vector3 start = new Vector3(0, 0, 0);
Vector3 end = new Vector3(10, 0, 0);
MeshTraceRequest request = new MeshTraceRequest().Ray(ref start, ref end);
MeshTraceRequest.Result result = request.Run();
if (result.Hit)
{
    // Process hit result
}