On_PinchIn用来检测为挤压
float zoom = Time.deltaTime * gesture.deltaPinch/25;
Vector3 scale = transform.localScale ;
if (scale.x - zoom>0.1)
transform.localScale = new Vector3( scale.x - zoom, scale.y -zoom,1f);
缩小
On_PinchOut用来检测扩张
float zoom = Time.deltaTime * gesture.deltaPinch/25;
Vector3 scale = transform.localScale ;
if ( scale.x + zoom<3 )
transform.localScale = new Vector3( scale.x + zoom, scale.y +zoom,1f);
放大
Twist 用来旋转gesture.twistAngle
On_Drag 拖动
gesture.GetTouchToWordlPoint(获得当前点的位置)
if (gesture.touchCount==1){
Vector3 position = gesture.GetTouchToWordlPoint(1);
if (newPivot){
deltaPosition = position - transform.position;
newPivot = false;
}
transform.position = position - deltaPosition;
}