Which in some cases, might be exactly what you want. In this example, the field of view setting is instantly set to the new value, which snaps the camera to the new zoom level immediately. So, for example, instead of zooming to a fixed field of view angle, you’ll be zooming to a multiplier of the player’s setting. You may have noticed that, in many games, you’re able to manually change the field of view setting, as increasing the field of view can help some players avoid motion sickness while reducing it can improve performance (since less of the game world is being rendered).īy changing the relative value, instead of setting a new, absolute viewing angle, you’ll be able to create a zoom effect that’s relative to the player’s view settings. In this basic example, the field of view property is set to half of a locally stored default value (which has been set to 90 degrees) to create a 2x zoom whenever the right mouse button is held down. Like this: public class x2Zoom : MonoBehaviour Which makes it ideal for lens-based zoom effects, like weapon zoom.įor example, you could use a field of view zoom to create a weapon zoom effect when the right mouse button is held down. While a narrow field of view, shows less of the camera image, zooming it in.įor example, halving the camera’s field of view has the effect of 2x magnification, while dividing it by four will zoom the camera in by 4 times. The field of view zoom effect, which works with cameras using the standard perspective projection mode, is similar to the effect of looking through a sniper scope or a telescope. In fact, all you need to do to create a basic zoom effect is reduce the camera’s Field of View property. The basic method of zooming a camera in Unity can be very straightforward. How to zoom a camera in Unity (using field of view)
0 Comments
Leave a Reply. |