- Home /
Best way to move object
Can anyone tell me how is the best way to move some object in 2D scene(x position)?
CharacterController.Move, SimpleMove or Translate?
and have one way to get if the touch are on left or rigt from my object.
tks
Answer by Jeff-Kesselman · May 25, 2014 at 08:58 PM
It totally depends on what you are trying to do.
CharacterController.SimpleMove move the object over time in a specified direction. CharacterController.Move moves the object over time taking collision into account transform.Translate instantly moves the character to the new location
I suggest you read the docs on all 3.
To determine if a touch is on the left or right side either Convert your character's world position to screen position with http://docs.unity3d.com/Documentation/ScriptReference/Camera.WorldToScreenPoint.html and compare with the touch point OR Convert the touch point to a world position with http://docs.unity3d.com/Documentation/ScriptReference/Camera.ScreenToWorldPoint.html and compare with the character's world position.
Your answer
![](https://koobas.hobune.stream/wayback/20220613145856im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can i move a 2D ball ? 0 Answers
translate 2 Answers
Make your player not move during a animation? 0 Answers
move character controller forward using gui button. 1 Answer
objects to move when picked up 0 Answers