Moving an Object to the position of touch

Hello!

I am trying to move an object to a position in the world by using the touch position but I am having a few problems with this. My code is as follows:

var curScreenPoint = Vector3(Input.GetTouch(0).position.x *Time.deltaTime, Input.GetTouch(0).position.y *Time.deltaTime, -1.475328);
var curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint);
print(curPosition);
transform.Translate(curPosition);

1 Answer

1

Translate take a movement, not a position. Use transform.position instead.