This is pretty simple. You can use the Vector3.Lerp function to achieve this. Use raycasting to get the mouse click position or the touch position. Then use the initial and the final position in the lerp function. The initial position being the position that the gameobject is at now and the final position being the click / touch position.
You can find the article by The Game Contriver on the same here
[Move to Touch / Click Position - The Game Contriver][1]
[1]: http://www.thegamecontriver.com/2014/10/move-to-mouse-click-touch-position-unity.html
↧