- Home /
How do you make an object stay animated while moving?
I'll give more detail. Im doing a click to move Game, where the player only has one thing do when it moves, which is run, When i hold down the mouse button to move the said object , It animates,, when i let go of the mouse button, it goes into idle, but the problem is I want the object to continue to animate this walk cycle until arriving to the destination clicked on, I think i need to change the click to move command to one something else to animate it, any ideas? i changed it to getkeyup , any help would be apreciated heres the script `using UnityEngine; using System.Collections;
public class Animations : MonoBehaviour {
// Update is called once per frame void Update () { if (Input.GetKey("up")) { animation.CrossFade("WalkCycle"); } else { animation.Stop(); } } }`
You need to put the character into a "moving state" while it is going to its destination and then turn that state off when it gets there. When in the moving state (which could be as simple as a bool is$$anonymous$$oving) dont stop your animation.
Answer by Sisso · Nov 09, 2012 at 03:26 PM
Have you tried to put animation in a infinite loop?
GetComponent(Animation).wrapMode = WrapMode.Loop;
References:
Your answer
Follow this Question
Related Questions
How much money would it take to have some one animate something for me? 0 Answers
Animated material 1 Answer
Move cube forward 0 Answers
Animation resetting to the muscle pose 0 Answers
Help with Custom Player Controller 0 Answers