# Vector3.WithZ

```csharp
Vector3 WithZ(float z)
```

Returns this vector with given Z component.

### Parameters

- `z` (`float`): The override for Z component.

### Returns

`Vector3`: The new vector.

Declared in [Vector3](/api/Vector3).
Assembly: `Sandbox.System`.
