The Ray
method in the SceneTrace
struct is used to cast a ray from a starting point to an ending point within the scene. This method is useful for detecting intersections or collisions along the path of the ray.
The Ray
method in the SceneTrace
struct is used to cast a ray from a starting point to an ending point within the scene. This method is useful for detecting intersections or collisions along the path of the ray.
To use the Ray
method, you need to provide two Vector3
references representing the start and end points of the ray. The method returns a SceneTrace
object that can be further configured or executed to perform the trace.
// Example of using the Ray method Vector3 startPoint = new Vector3(0, 0, 0); Vector3 endPoint = new Vector3(10, 0, 0); SceneTrace trace = new SceneTrace(); SceneTrace result = trace.Ray(ref startPoint, ref endPoint); // Further configuration or execution of the trace can be done here SceneTraceResult traceResult = result.Run(); if (traceResult.Hit) { // Handle the hit result GameObject hitObject = traceResult.Entity; // Perform actions based on the hit object }