---
layout: doc
title: general / lookat_rotate
---
# lookat_rotate

### NAME

    lookat_rotate() - build a look-at rotation from the current matrix

### SYNOPSIS

    float array lookat_rotate( float array matrix, float x, float y, float z );

### DESCRIPTION

    Replaces matrix with a look-at transform and returns matrix.  The x, y,
    and z arguments describe the point being looked at.  The eye point is
    taken from the translation component of the current matrix.

    The argument must be a 16 element float array in the format returned by
    id_matrix().  This efun modifies the supplied matrix array in place.

    The driver calculates the forward vector from the current eye point to
    the look point, derives the remaining basis vectors from the current
    matrix, normalizes them, and writes the resulting view matrix back into
    the supplied array.

### SEE ALSO

    lookat_rotate2(3), id_matrix(3), translate(3)
