The Forward
property of the Ray
struct represents the direction in which the ray is pointing. It is a Vector3
type, indicating the 3D direction vector of the ray.
The Forward
property of the Ray
struct represents the direction in which the ray is pointing. It is a Vector3
type, indicating the 3D direction vector of the ray.
Use the Forward
property to access or modify the direction of a ray. This property is essential when you need to determine the path along which the ray travels in 3D space.
// Example of using the Ray struct and its Forward property Ray ray = new Ray(); ray.Position = new Vector3(0, 0, 0); // Set the origin of the ray ray.Forward = new Vector3(1, 0, 0); // Set the direction of the ray to point along the x-axis // Accessing the Forward property Vector3 direction = ray.Forward; // Output the direction // Note: Avoid using Console.WriteLine in s&box // Instead, use in-game debugging tools or loggers // Debug.Log(direction);