Question by
Wisplex · Jun 06, 2018 at 01:11 PM ·
camerarotationjavascript
Rotate Camera only Horizontal?
So, I've got this piece of code which makes a camera rotating in all directions but how can I make it rotating horizontally?`
pragma strict
var speed = 75.0;
function Update() { var v3 = new Vector3(Input.GetAxis("Vertical"), Input.GetAxis("Horizontal"), 0.0); transform.Rotate(v3 speed Time.deltaTime); }`
Comment
Answer by MagnaDever · Jun 06, 2018 at 07:02 PM
At first, insert code into "Code sample" section. At second, see at code. new Vector3(Input.GetAxis("Vertical"), Input.GetAxis("Horizontal"), 0.0);
First parametr manage vertical rotation, second horizontal rotation. Replace Input.GetAxis("Vertical")
to constant vertical value and you will be happiness ;)