Skip to content

shz_xmtrx_init_billboard_z

Markdown
SHZ_INLINE void shz_xmtrx_init_billboard_z(shz_vec3_t pos, shz_vec3_t eye) SHZ_NOEXCEPT;

Initializes XMTRX to the rotation about the Z axis that turns local +X toward eye, as seen from pos.

NameTypeDescription
posshz_vec3_tPosition of the billboarded object, used only to compute the direction to eye.
eyeshz_vec3_tPosition to face, such as the camera eye, in the same space as pos.

Nothing (void).

Axial billboarding about Z: the direction from pos to eye is projected onto the XY plane, normalized, and passed to shz_xmtrx_init_rotation_z_xy(). A rotation about Z cannot move +Z, so the quad faces along local +X. Only the rotation is written; pos is used for the direction and is not applied as a translation.

  • If eye lies on the Z axis through pos, the facing direction is undefined and no rotation is applied, leaving local +X unrotated.

shz_xmtrx_init_rotation_z_xy, shz_xmtrx_billboard_z, shz_xmtrx_init_billboard_x