The y
property of the Vector3
struct represents the Y component of a 3D vector. This component is a float
value and is used to define the position or direction along the Y-axis in 3D space.
The y
property of the Vector3
struct represents the Y component of a 3D vector. This component is a float
value and is used to define the position or direction along the Y-axis in 3D space.
You can access and modify the y
property directly to change the Y component of a Vector3
instance. This is useful when you need to manipulate the vector's position or direction along the Y-axis.
// Example of using the y property Vector3 position = new Vector3(1.0f, 2.0f, 3.0f); // Access the y component float yValue = position.y; // Modify the y component position.y = 5.0f; // Output the modified vector // position is now (1.0, 5.0, 3.0)