I have a script which i found somewhere online.
The below script works fine for rotation of game object along x axis ( horizontally ) but i am not able to get it working vertically ( along y axis ).
Code :
#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);
}
}
}
Any help appreciated !