C
C#2y ago
c_ccc

Camera Isnt Zooming Back Out

So, when the bullet is spawned, the camera zooms in to 55. Why when the FOV is = 55 doenst it zoom back out?
int zoom = 55;
int normal = 60;
float smooth = 12f;
float delay = .5f;
public GunController bulletCheck;
public Camera mainCam;

void Start()
{

}

// Update is called once per frame
void Update()
{
if (bulletCheck.shotSpawned == true)
{
mainCam.fieldOfView = Mathf.Lerp(GetComponent<Camera>().fieldOfView, zoom, Time.deltaTime * smooth);

}
if (mainCam.fieldOfView <= zoom)
{
// mainCam.fieldOfView = normal;
mainCam.fieldOfView = Mathf.Lerp(GetComponent<Camera>().fieldOfView, normal, Time.deltaTime * smooth);
}
}
int zoom = 55;
int normal = 60;
float smooth = 12f;
float delay = .5f;
public GunController bulletCheck;
public Camera mainCam;

void Start()
{

}

// Update is called once per frame
void Update()
{
if (bulletCheck.shotSpawned == true)
{
mainCam.fieldOfView = Mathf.Lerp(GetComponent<Camera>().fieldOfView, zoom, Time.deltaTime * smooth);

}
if (mainCam.fieldOfView <= zoom)
{
// mainCam.fieldOfView = normal;
mainCam.fieldOfView = Mathf.Lerp(GetComponent<Camera>().fieldOfView, normal, Time.deltaTime * smooth);
}
}
1 Reply
c_ccc
c_ccc2y ago
also i know instead og 'getcomponent...' i could do 'mainCam.field....' but that is not the issue SELF FIXED:
int zoom = 55;
int normal = 60;
float smooth = 100f;
float smooth2 = 10f;
float delay = 1.5f;
public GunController bulletCheck;
public Camera mainCam;

void Start()
{

}

// Update is called once per frame
void Update()
{
if (bulletCheck.shotSpawned == true)
{
delay -= Time.deltaTime;
mainCam.fieldOfView = Mathf.Lerp(mainCam.fieldOfView, zoom, Time.deltaTime * smooth);

}
if (delay <= 0)
{
// mainCam.fieldOfView = normal;
mainCam.fieldOfView = Mathf.Lerp(mainCam.fieldOfView, normal, Time.deltaTime * smooth2);
}
int zoom = 55;
int normal = 60;
float smooth = 100f;
float smooth2 = 10f;
float delay = 1.5f;
public GunController bulletCheck;
public Camera mainCam;

void Start()
{

}

// Update is called once per frame
void Update()
{
if (bulletCheck.shotSpawned == true)
{
delay -= Time.deltaTime;
mainCam.fieldOfView = Mathf.Lerp(mainCam.fieldOfView, zoom, Time.deltaTime * smooth);

}
if (delay <= 0)
{
// mainCam.fieldOfView = normal;
mainCam.fieldOfView = Mathf.Lerp(mainCam.fieldOfView, normal, Time.deltaTime * smooth2);
}
Want results from more Discord servers?
Add your server
More Posts