The y
property of the Vector2
struct represents the Y component of a 2-dimensional vector. This property is a floating-point value that can be used to access or modify the Y coordinate of the vector.
The y
property of the Vector2
struct represents the Y component of a 2-dimensional vector. This property is a floating-point value that can be used to access or modify the Y coordinate of the vector.
Use the y
property to get or set the Y component of a Vector2
instance. This is useful when you need to manipulate the vertical component of a vector in 2D space, such as when performing calculations related to position, movement, or size.
// Example of using the y property Vector2 position = new Vector2(); position.y = 10.0f; // Set the Y component float currentY = position.y; // Get the Y component // Output the Y component // Note: Avoid using Console.WriteLine in s&box // Instead, use logging or debugging tools provided by the environment // Log.Info($"Current Y: {currentY}");