unity camera rotates z axis code example
Example 1: unity rotate around axis
transform.Rotate(axis, degrees);
Example 2: touch unity rotate on x axis
#pragma strict private var h : float; private var v : float; private var horozontalSpeed : float = 1.0; private var verticalSpeed : float = 1.0; function Update() { if (Input.touchCount == 1) { var touch : Touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Moved) { var v : float = verticalSpeed * touch.deltaPosition.x ; transform.Rotate ( h, 0, 0); var h : float = horozontalSpeed * touch.deltaPosition.y ; transform.Rotate (0, -v, 0); } } }