- Home /
Question by
kunddizzle · Nov 08, 2010 at 09:40 AM ·
cameraiphonetouch
touch to move camera, scroll over level
Hi
Im making a game where i would like to move the camera with e.g. two fingers. I have something working at the moment
not correctly here, but:
if ( Input.touchCount == 2 )
{
iPhoneX = ((Input.GetTouch(0).deltaPosition.x+Input.GetTouch(1).deltaPosition.x)/2);
iPhoneY = ((Input.GetTouch(0).deltaPosition.y+Input.GetTouch(1).deltaPosition.y)/2);
cam.camX = iPhoneX*-1*0.1;
cam.camY = iPhoneY*-1*0.06;
}
It works and will also "fly" over the level when i release the swipe, and I made som boundaries (level start/end) it wont pass by.
But are there some examples out there? to make it even more smooth? E.g. pinch to zoom camera..
Thanks
Comment
Your answer
Follow this Question
Related Questions
2D Camera (Android, Iphone) 1 Answer
How do you map touch points to world space? 1 Answer
iphone camera rotation by touch 4 Answers
Camera orbit with touch 1 Answer
Rotate camera smoothly to certain degrees with iphone touch 2 Answers