- Home /
move character towards the mouse on click
hello. i've read every topic about my task i could found, but still didn't got it working. i have an animated characted and need to make it moving towards the cursor on click. could someone give me detailed instructions how to do it?
Im not very good at coding and i tried this and it didn't work:
Input.mousePosition Camera.ScreenToWorldPoint = $$anonymous$$ousePos Vector3.Lerp, $$anonymous$$ousePos;
Answer by HarshadK · Aug 08, 2014 at 02:12 PM
Instructions:
Get the position of click.
Convert that position to world coordinates using Camera.ScreenToWorldPoint.
Then move your character towards the target position using either Vector3.Lerp or MoveTowards or Translate or ...
While moving play the animation of character walking or running or whatever it is.
Viola! You are done.
Your answer
Follow this Question
Related Questions
First person controller not moving properly after rotation 1 Answer
Move waypoint mouse click 0 Answers
Making Character Stand? 1 Answer
CharacterController.SimpleMove() doesn't exist? 0 Answers
car and controller 1 Answer