I have a code that changes my camera’s field of view when an input is held. Here’s the script I have…
var zoom : int = 20;
var normal : int = 60;
var smooth : float = 5;
private var zoomedIn = false;
function Update()
{
zoomedIn = false;
if( Input.GetButton("Aim"))
{
zoomedIn = true;
}
if( zoomedIn == true )
{
GetComponent.<Camera>().fieldOfView = Mathf.Lerp( GetComponent.<Camera>().fieldOfView, zoom, Time.deltaTime*smooth );
}
else
{
GetComponent.<Camera>().fieldOfView = Mathf.Lerp( GetComponent.<Camera>().fieldOfView, normal, Time.deltaTime*smooth );
}
}
But, I want to change the output of the script. Instead of changing the variable field of view in the camera script, I want it to change the variable ‘AimY’ in the script ‘AimY’. How could I do this?