Hello friends,
I am a beginner in unity, I am making a 3d game in which I want the field of view of camera increase smoothly with the increase in speed of my moving game object (currently a cube) & vice versa. I am using transform.translate to move my cube for now, but it doesn’t seem to work for me till now to even accelerate and to change FOV either. But I would say that I have tried Mathf and Vector.Lerp too for doing what I want but I didn’t get the results.
Any help would be appreciated.
Thanks in advance.
@JeffHardddyyy I think, I didn’t asked question properly…
But still, looking at your this script, I have got idea for my game’s script and the problem is half solved.
Now the only problem remaining is of how to accelerate and de-accelerate my game object. Problem of FOV is solved.
Thanks for that.
Hopefully this works! Sorry you had to wait 24 hours to answer, Lol!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class myScript : MonoBehaviour
{
public Camera myCam; //the camera
public int amount; //how many times do you want it to
void Start()
{
for (int i = 0; i < amount; i++)
{
myCam.fieldOfView++;
}
}
}