Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Animator anim;
- public float speed = 1.5f;
- private Vector3 target;
- void Start () {
- anim = GetComponent<Animator>();
- target = transform.position;
- }
- void Update () {
- if (Input.GetMouseButtonDown(0)) {
- target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
- target.z = transform.position.z;
- //its working fine
- anim.SetInteger ("Direction", 1);
- }
- transform.position = Vector3.MoveTowards(transform.position, target,speed * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement