Quantcast
Channel: Questions in topic: "fps demo"
Viewing all articles
Browse latest Browse all 4

Pinch zoom in windows 8 pc

$
0
0
hi, everyone i am working on simple orbit and zoom in/out using touch gesture. touch orbit is working excellent but pinch zoom in/out is the main prob.. i tried other scripts also but no success .. one of the script i applied. ------------------------------------------------------------------------------------------ using UnityEngine; using System.Collections; public class PinchZoom : MonoBehaviour { public float perspectiveZoomSpeed = .5f; public float orthoZoomSpeed = .5f; // Update is called once per frame void Update () { if (Input.touchCount == 2) { Touch touchZero = Input.GetTouch(0); Touch touchOne = Input.GetTouch(1); Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition; Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition; float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude; float touchDeltaMag = (touchZero.position - touchOne.position).magnitude; float deltaMagnitudediff = prevTouchDeltaMag - touchDeltaMag; if(camera.isOrthoGraphic) { camera.orthographicSize += deltaMagnitudediff * orthoZoomSpeed; camera.orthographicSize = Mathf.Max(camera.orthographicSize , .1f); } else { camera.fieldOfView += deltaMagnitudediff * perspectiveZoomSpeed; camera.fieldOfView = Mathf.Clamp(camera.fieldOfView, .1f , 179.9f); } } } } ------------------------------------------------------------------------------------------ i found one demo for touch script i was planing to buy that plugin for my solution. but same prob occur in plugin's web player demo ... here's the link of plugin's demo. [http://fingergestures.fatalfrog.com/features/online-demo][1] i tried in my windows 8 laptop and also on lenovo Horizon. same issue .. plz guys tell me whats the prob i am facing.?? thanx [1]: http://fingergestures.fatalfrog.com/features/online-demo

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images