iphone camera rotation by touch

Hi

I'm doing an airplane game and I want to be able to look to the sides of the cockpit. I want then that the user can press the center of the screen and slide the finger from left to right or viceversa and the camera will look into that direction.

How can I do this? I was thinking maybe using a sphere collider and detecting a raycast but since i only want to use horizontal movement i don't know if that's the best way to achieve it. Any ideas? Any easy script?

Hmm, the first thing I would try is to use touch deltaPosition to modify the camera's localEulerAngles.z property.

Were you able to figure this out? I'm banging my head right now trying to get it working. Thanks.

Hey Guys have you found any think about this??? :(

Hi, I have something you just have to set it up to work for your game

// If there is one touch on the device…
if(Input.touchCount == 1)
{
// Store touch.
Touch touchZero = Input.GetTouch(0);

		// Find the position in the previous frame of touch.
		Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;

		// Find the magnitude of the vector (the distance) between the touches in each frame.
		Vector2 prevTouchDeltaMag = touchZeroPrevPos;
		Vector2 touchDeltaMag = touchZero.position;
		
		// Find the difference in the distances between each frame.
		Vector2 deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag;

		transform.RotateAround(Vector3.zero, transform.up, -deltaMagnitudeDiff.x * (dragSpeed / 400f));
		transform.RotateAround(Vector3.zero, transform.right, deltaMagnitudeDiff.y * (dragSpeed / 400f));
	}