I want to rotate Sphere in the same place as like mouse scroll. The Sphere should not change place but I can rotate it from my finger touch in Android. If someone please help me how to do that?
Thanks
If your setup is a static camera looking towards positive āzā, this code may be what you are looking for:
#pragma strict
public var factor = 4.0;
private var v3Start : Vector3;
function OnMouseDown() {
v3Start = Input.mousePosition;
}
function OnMouseDrag() {
var v3Direction = Input.mousePosition - v3Start;
var v3Axis : Vector3;
v3Axis.y = -v3Direction.x;
v3Axis.x = v3Direction.y;
v3Axis.z = 0.0;
transform.RotateAround(transform.position, v3Axis, v3Direction.magnitude/Screen.height * 100.0 * factor);
v3Start = Input.mousePosition;
}