- Home /
zooming in and out
i have this code what works and zooms me in but how do i zoom out ?
private var baseFOV : float;
function Start () { baseFOV = camera.fieldOfView;
}
function Update () { if (Input.GetMouseButton(1)) camera.fieldOfView = 37; //add the Code for texture changing to Sniper Scope here else camera.fieldOfView = baseFOV; ? //add the code for texture changing to normal scope here
}
if (Input.GetMouseButton(2)) camera.fieldOfView = 60; //add the Code for texture changing to Sniper Scope here else camera.fieldOfView = baseFOV; ? //add the code for texture changing to normal scope here
Can you format the code in your question with the 'CODE' button, so it's easier to read? It's a bit hard to follow as is.
Answer by Professor Sody · Sep 03, 2013 at 11:02 AM
add a boolean flag e.g. isSniper = false;
Check for flag when you press the sniper scope button if its true change it to false and change field of view to normal , if its false (it should be at the start) change it to true and change field of view to sniper mode.
Your answer
Follow this Question
Related Questions
Change UI scale in relation to 3D camera 0 Answers
How to do perspective camera zoom? 1 Answer
Changing camera position to shoot through scope on gun 1 Answer
Raycast misses after camera zoom 2 Answers
Lining up Fov's 0 Answers