float y { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The y property of the Vector3 struct represents the Y component of a 3D vector. This property is a floating-point value that can be used to get or set the Y coordinate of the vector.

Usage

Use the y property to access or modify the Y component of a Vector3 instance. This is useful when you need to perform operations that involve the Y axis, such as moving an object vertically in a 3D space.

Example

// 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;

// Now position is (1.0f, 5.0f, 3.0f)