阅读背景:

基础代码--显示触摸屏幕的第一个手指的接触前后位置

来源:互联网 
using UnityEngine;
using System.Collections;
public class TurnTable1 : MonoBehaviour {
	float h;  
	float v; 
	Vector3 v30 = Vector3.zero;
	Vector3 v31 = Vector3.zero;

	void Update(){  
		if (Input.touchCount <= 0)
			return;

		Touch tc = Input.GetTouch(0);
		if(tc.phase==TouchPhase.Began){  
			v30 = tc.position;
		}  
		
		if (tc.phase == TouchPhase.Ended) {
			v31 = tc.position;
		}
	}  

	void OnGUI () {
		GUI.skin.label.fontSize = 28;
		GUI.Label (new Rect (50, 200, 200, 100), "p1=" + v30.x + "+" + v30.y + "+" + v30.z );
		GUI.Label (new Rect (50, 300, 200, 100), "p2=" + v31.x + "+" + v31.y + "+" + v31.z );
	}
}using UnityEngine;
using System.Collections;
pu



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: