Matrix.lookAt constructor
Returns a view matrix oriented from eye toward target, with up defining the vertical axis.
Implementation
factory Matrix.lookAt(Vector3 eye, Vector3 target, Vector3 up)
{
final vz = eye.sub(target).normalize();
final vx = up.crossProduct(vz).normalize();
final vy = vz.crossProduct(vx);
final Matrix result = .zero();
result.m0 = vx.x;
result.m1 = vy.x;
result.m2 = vz.x;
result.m4 = vx.y;
result.m5 = vy.y;
result.m6 = vz.y;
result.m8 = vx.z;
result.m9 = vy.z;
result.m10 = vz.z;
result.m12 = -vx.dotProduct(eye);
result.m13 = -vy.dotProduct(eye);
result.m14 = -vz.dotProduct(eye);
result.m15 = 1.0;
return result;
}