I make a game object and I add an animation to it. This animation has position (0,0,0) on 0 second, and (0,2,0) on 0.5 second and (0,0,0) on 1seocnd. (up and down animation)
I add an script to this game object that has code as follows.
this.GetComponent ().velocity = new Vector2 (-1*moveSpeed, 0);
I want to move my object toward -X axis and also I want my game object to move as it was animated.
As a result, my object doesn’t move toward -X axis, and just follow as it was animated.
Is there any solution that can move animated game objects(which I animate its position) as I want?
It would be really glad if you help me. Have a nice day.