I have a perspective FOV, but when rotating, it doesn't "look" correct - Farther objects traverse faster than closer objects, passing them in the middle of the screen.
So: Is this correct? Using right-handed coordinates, if that matters?
public static Matrix4x4 PerspectiveFOV(float fov, float aspect, float near, float far)
{
float yScale = 1.0F / (float)Math.Tan(fov / 2);
float xScale = yScale / aspect;
float farmnear = far - near;
return new Matrix4x4(
xScale, 0, 0, 0,
0, yScale, 0, 0,
0, 0, far / (farmnear), 1,
0, 0, -near * (far / (farmnear)), 1
);
}
Thanks.