NaN Camera.FieldOfView Not Corrected

If you set a Camera’s FieldOfView property to nan or -nan, the engine does not correct it and results in a black screen.

Yes, my code should never be attempting to set nan, however I recently ran into a case where it did (no clue how), and players under certain scenarios ended up with this screen:

This has never happened in this game up until yesterday.

Repro:

  1. Open new place file
  2. Run this code in the command bar
    workspace.CurrentCamera.FieldOfView = 0/0
  3. Observe black screen and engine output warning of

18:48:43.103 - FieldOfView set out of range, should be between 1.000000 and 120.000000, setting to -nan(ind)

The engine should check for nan and refuse the set attempt and set FieldOfView back to the previous value, or default to 70.

This was reported here however it never got through post approval.

I don’t believe this is platform specific however I’ve only received reports from Windows 10 users.

Interesting note - all other cameras (such as ViewportFrame cameras) turn black in colour when the workspace’s Camera.FieldOfView is set to nan.

8 Likes