Okay i have made my script:
var gun : Transform;
var nextPos = 0.0;
var nextField = 40.0;
var nextPos2 = -0.2;
var dampVelocity = 0.4;
var dampVelocity2 = 0.4;
var dampVelocity3 = 0.4;
function Update () {
var newPos = Mathf.SmoothDamp(gun.transform.localPosition.x, nextPos, dampVelocity, .3);
var newField = Mathf.SmoothDamp(Camera.main.fieldOfView, nextField, dampVelocity2, .3);
var newPos2 = Mathf.SmoothDamp(gun.transform.localPosition.y, nextPos2, dampVelocity3, .3);
gun.transform.localPosition.x = newPos;
gun.transform.localPosition.y = newPos2;
Camera.main.fieldOfView = newField;
if (Input.touchCount > 0) {
nextField = 40.0;
nextPos = -0.145;
nextPos2 = -0.096;
} else {
nextField = 70.0;
nextPos = 0.0;
nextPos2 = -0.2;
}
}
But i would like to assign it to a button like the movement is in the first person camera demo.
how would i make the button and assign it the code is confusing and does not explain the commands well