I have a sphere moving from left to right by use of an animation. To the interface, I’ve added a button that will advance the animation by a set interval called delta
.
Below is my moveObject script which is attached to the Sphere.
var objectAnimation:Animation;
function Movement(delta:float){
animation[objectAnimation.clip.name].time += delta;
}
This function is called from the button within it’s button press method as below:
moveTarget.GetComponent(MoveObject).SendMessage("Movement", 1.0);
A Debug.Log
of animation[objectAnimation.clip.name].time
shows that it is indeed changing every time the button is pressed. Say for instance, the delta is 1, in my tests, every time the button is pressed, the Debug.Log returns 1, then 2, then 3 etc. However, the animation itself does not advance, the Sphere stays in the same place all the time.
What am I doing wrong here?