float z { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The z property of the Vector3 struct represents the Z component of a 3D vector. This component is a float value and is used to define the position or direction along the Z-axis in 3D space.

Usage

Use the z property to get or set the Z component of a Vector3 instance. This is useful when you need to manipulate or access the Z-axis value of a vector in 3D space.

Example

// Example of using the z property
Vector3 position = new Vector3(1.0f, 2.0f, 3.0f);

// Access the Z component
float zValue = position.z;

// Modify the Z component
position.z = 5.0f;

// Output the modified vector
// position is now (1.0, 2.0, 5.0)