I recently tried this code in 4.15, I wanted to do a quick test with mesh-specific FOV. In case somebody wants a more up-to-date version, here are some things I had to change:
MinZ should be your NearClippingDistance as staticvoidlol mentioned, but yours might not be 5, so make sure it’s correct.
The members used in FViewMatrices are now private, and there’s no real use to go through that class at all, so I replaced the final math in GetViewMatrices with:
FMatrix ProjMatrix = ProjectionData.ProjectionMatrix;
FMatrix InvProjectionMatrix = ProjMatrix.Inverse();
FMatrix InvViewMatrix = FTranslationMatrix(-viewMatrix.GetOrigin()) * viewMatrix.RemoveTranslation().GetTransposed();
invViewProjectionMatrix = InvProjectionMatrix * InvViewMatrix;