The Ray
method in the SceneTrace
struct is used to cast a ray from a starting point to an ending point in 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 in 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(); trace = trace.Ray(ref startPoint, ref endPoint); // Run the trace to get the result SceneTraceResult result = trace.Run(); if (result.Hit) { // Handle the hit Vector3 hitPosition = result.Position; // Additional logic here }