# shz_xmtrx_init_rotation_z_xy

Source: https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_z_xy/

> Initializes XMTRX to the rotation about the Z axis that turns local +X toward the unit direction (x, y, 0)

```c
SHZ_INLINE void shz_xmtrx_init_rotation_z_xy(float x, float y) SHZ_NOEXCEPT;
```

Initializes XMTRX to the rotation about the Z axis that turns local +X toward the unit direction (`x`, `y`, 0).

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `x` | `float` | X component of the unit direction. |
| `y` | `float` | Y component of the unit direction. |

## Returns

Nothing (`void`).

## Details

Equivalent to `shz_xmtrx_init_rotation_z()` for the angle whose sine is `y` and cosine is `x`.

## Warnings

- (`x`, `y`) must be unit length.

## Availability

- **C++ equivalent:** [`shz::xmtrx::init_rotation_z_xy`](https://sh4zam.com/api/cpp/xmtrx/#init_rotation_z_xy)
- **Type-generic form:** none
- **Back-ends:** SH4: dedicated SH4 implementation · SW: portable C · SPU: shared C implementation
- **Defined in:** [`sh4zam/shz_xmtrx.h:391`](https://github.com/gyrovorbis/sh4zam/blob/6b22b851ad9ca109049f956dbbbecf7c519c959f/include/sh4zam/shz_xmtrx.h#L391)
- **Module:** [XMTRX](https://sh4zam.com/api/xmtrx/), section "Initialization"

## See also

[`shz_xmtrx_rotate_z_xy`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate_z_xy/), [`shz_xmtrx_init_billboard_z`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_billboard_z/)
