Advertisement
Guest User

Untitled

a guest
May 5th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. private Animator anim;
  2. public float speed = 1.5f;
  3. private Vector3 target;
  4.  
  5. void Start () {
  6. anim = GetComponent<Animator>();
  7. target = transform.position;
  8. }
  9.  
  10. void Update () {
  11. if (Input.GetMouseButtonDown(0)) {
  12. target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
  13.  
  14. target.z = transform.position.z;
  15. //its working fine
  16. anim.SetInteger ("Direction", 1);
  17. }
  18. transform.position = Vector3.MoveTowards(transform.position, target,speed * Time.deltaTime);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement