Hello all,
I’m having trouble getting input.touchCount to equal anything other than zero. Here’s my code (using Unity 3 beta):
function FixedUpdate () {
var worldAngle : Vector3 = Vector3.zero;
var playermodel = GameObject.Find("Player");
var frisbee = GameObject.Find("frisbee");
var i : int;
i = Input.touchCount;
if (i > 0) {//check to make sure we have at least 1 touch
var touch : Touch = Input.GetTouch(0); //Get the first touch
var delta : float = touch.deltaPosition.magnitude;
delta /= Time.deltaTime;
if (Input.GetTouch(i).phase == TouchPhase.Ended){
frisbee.rigidbody.AddForce (Camera.main.transform.forward*delta);
}
}
}
The problem being it never seems to get inside the if test i>0. Anyone have any thoughts as to why this might be the case? Many thanks for any help, much appreciated!