вот мой сценарий, который я сделал
Код: Выделить всё
void Update () {
if (Input.touchCount > 0)
{
Touch _touch = Input.GetTouch(0); // screen has been touched, store the touch
if( _touch.phase == TouchPhase.Moved) // finger moved
{
//offset = Camera.main.ScreenToWorldPoint(new Vector3(_touch.position.x, _touch.position.y, theplayer.transform.position.z)) - theplayer.transform.position;
touchPos = Camera.main.ScreenToWorldPoint(new Vector3(_touch.position.x, _touch.position.y, theplayer.transform.position.z));
theplayer.transform.position = Vector2.Lerp(theplayer.transform.position, touchPos, Time.deltaTime*5f);
}
else if(_touch.phase == TouchPhase.Ended){
touchPos = Vector3.zero;
offset = Vector3.zero;
}
}
} // end
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/398 ... in-unity3d