- Home /
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);
Comment
Answer by Berenger · Mar 12, 2012 at 01:05 AM
Translate take a movement, not a position. Use transform.position instead.
Your answer
Follow this Question
Related Questions
TouchCount always > 0 on Android 1 Answer
Converting screen coordinates to world coordinates 1 Answer
Why does my app function correctly in Unity Remote but not compiled as an app? 0 Answers
Avoid touch input when pressing the "Pause" button 1 Answer
How to correctly detect touch and apply single action? 1 Answer