Vector3 Forward { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Forward property of the Ray struct represents the direction in which the ray is pointing. It is a Vector3 type, which means it contains three components (x, y, z) that define the direction vector in 3D space.

Usage

Use the Forward property to determine or set the direction of a ray in 3D space. This is useful in scenarios where you need to calculate intersections, reflections, or simply understand the orientation of the ray.

Example

// 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
// Console.WriteLine(direction); // Avoid using Console.WriteLine in s&box