You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
510 B
26 lines
510 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class CameraFOV : MonoBehaviour |
|
{ |
|
public Camera cam; |
|
|
|
public Vector2 sizeScreen; |
|
public float FOV; |
|
|
|
float ratioMaking, ratioDevice; |
|
|
|
private void Start() |
|
{ |
|
Setting(); |
|
} |
|
|
|
public void Setting() |
|
{ |
|
ratioMaking = (sizeScreen.x / sizeScreen.y); |
|
ratioDevice = ((float)Screen.width / Screen.height); |
|
|
|
cam.fieldOfView = FOV * ratioMaking / ratioDevice; |
|
} |
|
}
|
|
|