This should work for you:
//-----------------------------------------------------------------------
// Vector Routines
//-----------------------------------------------------------------------
void GV_VectorCrossProduct(PR_POINT *dest, PR_POINT *src1, PR_POINT *src2)
{
dest->x = src1->y * src2->z - src1->z * src2->y;
dest->y = src1->z * src2->x - src1->x * src2->z;
dest->z = src1->x * src2->y - src1->y * src2->x;
}
//-----------------------------------------------------------------------
// Matrix Routines
//-----------------------------------------------------------------------
void GV_RotateMatrixToPoint(PR_MATRIX mat, PR_POINT *src, PR_POINT *dest)
{
PR_POINT i, j, k;
// calc forward vector
k.x = dest->x - src->x;
k.y = dest->y - src->y;
k.z = dest->z - src->z;
PR_Normalize(&k);
// calc up vector
j.x = 0;
j.y = 1;
j.z = 0;
// calc right vector
GV_VectorCrossProduct(&i, &j, &k);
// calc new up vector
GV_VectorCrossProduct(&j, &i, &k);
// store in rotation matrix
mat[0] = i.x;
mat[1] = i.y;
mat[2] = i.z;
mat[3] = 0;
mat[4] = -j.x;
mat[5] = -j.y;
mat[6] = -j.z;
mat[7] = 0;
mat[8] = k.x;
mat[9] = k.y;
mat[10] = k.z;
mat[11] = 0;
//mat[12] = trans->x;
//mat[13] = trans->y;
//mat[14] = trans->z;
mat[15] = 1.0;
}
Just pass in the Entity->orientation.rot_mat, the source pos of the entity and the dest pos of where you what to look. Afterwords, the entity will be pointing at the dest. If you want a higher end function that will allow you to interporlate from any orientation to the dest point across N number of frames, e-mail me and I can send it to you. I am using this in my current game to make the enemy ships find there way to the player or any object, find powerups and so forth.