- Home /
Pinch zoom in windows 8 pc
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
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
But what exactly is the problem? Does it work but not as intended, or what? Need more info on this to help you.
mul$$anonymous$$ch in windows 8 is not working not in my project not in online web player demo.
Your answer
![](https://koobas.hobune.stream/wayback/20220613145630im_/https://answers.unity.com/themes/thub/images/avi.jpg)