Skip to main content
added 326 characters in body
Source Link
tmighty
  • 919
  • 15
  • 39

How do I set horizonal Field of View by code as in Inspector?

I have a camera that I have set to

RenderType = Base
Projection = Perspective
FOV Axis = Horizontal
Field of View = 75
Physical Camera = False
Clipping Planes Near = 0.3, Far  = 1000

enter image description here

If I set Field of View values during gameplay in the Inspector, it works as expected.

For example, I type 75, and the camera behaves as I think it should. I'm comparing with Resident Evil 4. It has a camera cheat, and if I select FOV 75 in this cheat, the Resident Evil 4 camera behaves like my Unity game camera.

However, when I set the camera.fieldOfView to a 75 by code, it is converted to something else, likethe Inspector shows 104, and the code does not look as it looks when I type 75 in the Inspector.

_camera.fieldOfView however returns 75.

What is going on here, and how do I fix it?

Thank you!

How do I set horizonal Field of View by code?

I have a camera that I have set to

RenderType = Base
Projection = Perspective
FOV Axis = Horizontal
Field of View = 75
Physical Camera = False
Clipping Planes Near = 0.3, Far  = 1000

enter image description here

If I set Field of View values during gameplay in the Inspector, it works as expected.

However, when I set the camera.fieldOfView to a 75 by code, it is converted to something else, like 104.

What is going on here, and how do I fix it?

Thank you!

How do I set horizonal Field of View by code as in Inspector?

I have a camera that I have set to

RenderType = Base
Projection = Perspective
FOV Axis = Horizontal
Field of View = 75
Physical Camera = False
Clipping Planes Near = 0.3, Far  = 1000

enter image description here

If I set Field of View values during gameplay in the Inspector, it works as expected.

For example, I type 75, and the camera behaves as I think it should. I'm comparing with Resident Evil 4. It has a camera cheat, and if I select FOV 75 in this cheat, the Resident Evil 4 camera behaves like my Unity game camera.

However, when I set the camera.fieldOfView to a 75 by code, the Inspector shows 104, and the code does not look as it looks when I type 75 in the Inspector.

_camera.fieldOfView however returns 75.

What is going on here, and how do I fix it?

Thank you!

Source Link
tmighty
  • 919
  • 15
  • 39

How do I set horizonal Field of View by code?

I have a camera that I have set to

RenderType = Base
Projection = Perspective
FOV Axis = Horizontal
Field of View = 75
Physical Camera = False
Clipping Planes Near = 0.3, Far  = 1000

enter image description here

If I set Field of View values during gameplay in the Inspector, it works as expected.

However, when I set the camera.fieldOfView to a 75 by code, it is converted to something else, like 104.

What is going on here, and how do I fix it?

Thank you!