The y
property of the Vector3
struct represents the Y component of a 3D vector. It is a floating-point value that can be accessed and modified to change the Y coordinate of the vector.
The y
property of the Vector3
struct represents the Y component of a 3D vector. It is a floating-point value that can be accessed and modified to change the Y coordinate of the vector.
Use the y
property to get or set the Y component of a Vector3
instance. This property is useful when you need to manipulate or retrieve the Y coordinate of a vector in 3D space.
// 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 Vector3 modifiedPosition = position; // Now (1.0f, 5.0f, 3.0f)