- Home /
Camera smooth transistion
Hey, I am making an experimental FPS game and I have two cameras. The main camera which shows me holding the gun and another Scope Camera which shows the gun zoomed in. Is there anyway I can make a smooth transition between these two cameras without messing around with FOV?
Comment
do you mean FADING (ie $$anonymous$$IXING) between the two cameras ?
use Eric's scripts
Answer by Griffo · Oct 12, 2012 at 07:42 AM
I use the same camera, I just zoom the camera into the new position like below, then move the weapon using the Vector3 to get the position you want.
Just attach the script to your main camera.
#pragma strict
var zoom : int = 20;
var normal : int = 60;
var smooth : float = 5;
function Awake(){
}
function Start(){
}
function Update () {
if (Input.GetButtonDown("Zoom In")){
camera.fieldOfView = Mathf.Lerp(camera.fieldOfView,zoom,Time.deltaTime*smooth);
}else{
camera.fieldOfView = Mathf.Lerp(camera.fieldOfView,normal,Time.deltaTime*smooth);
}
}
Answer by Uninity · Oct 12, 2012 at 03:07 PM
if (Input.GetButtonDown("Zoom In")){
camera.fieldOfView = Mathf.Lerp(camera.fieldOfView,zoom,Time.deltaTime*smooth);
}else{
camera.fieldOfView = Mathf.Lerp(camera.fieldOfView,normal,Time.deltaTime*smooth);
}
}
What do I replace the (Input.GetButtonDown("Zoom In") with? ("Zoom In")