So i have my own javascript on the scope effect ( zooming in ) , but i want to play an animation or by code to look down the sights if my FOV has increased.
public var Aim : boolean = false;
public var deffFOV : float;
public var CAM : GameObject;
function Start () {
deffFOV = CAM.camera.fieldOfView;
}
function Update () {
if(Input.GetMouseButtonDown(1)){
Aim = true;
}
if(Input.GetMouseButtonUp(1)){
Aim = false;
}
if(Aim) {
CAM.camera.fieldOfView = Mathf.Lerp(CAM.camera.fieldOfView, FOVIN , FOVspeed * Time.deltaTime);
}
if(!Aim){
CAM.camera.fieldOfView = Mathf.Lerp(CAM.camera.fieldOfView , deffFOV , FOVspeed * Time.deltaTime);
}
}
EDIT (MOD):
It seriously doesn’t take more than 2 minutes to fix up the code. Please do so yourself next time you’re asked to