Question by
Creative Inventory · Aug 22, 2015 at 12:49 PM ·
c#animationscript.
Animation
Could some help with my animation and the script please. Okay I'm making a game for android where you can click on the screen and the player will move to where you tap, I want to add animation to it. I have already added the animation and did the animator, but i don't know how tell my script to use the animation to my player movement script. I know i have to include something in it but i don't know what. Could some one please help, my script is below:
public float speed = 5f;
private Vector3 target;
void Start () {
target = transform.position;
}
void Update () {
if (Input.GetMouseButtonDown(0)) {
target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
target.z = transform.position.z;
}
transform.position = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);
}
}
Comment