Re-positioning objects after animation done playing?

I’m an artist trying to setup a little test system for myself.

Problem: I know how to play animations and re-position objects but I cannot figure out how to make it so that once Camera(in this case) is done animating: move the camera to x,x,x and then play next animation.

I know I can queue animations by changing the QueueMode, which is solving the animation-part of the problem. But I cannot seem to “queue” the re-positioning of the Camera.

I have very limited knowledge of C# so I am not really looking for anything fancy. Just something simple that allows me to test so I can then ship off the animations as they are.

1 Answer

1

See I don’t know exactly if any function is available for this purpose or not but here I have done something logical.

I took an empty game object and set the position of the cube (object in my case) and the empty game object same.

Then I wrote following script :

#pragma strict
var repos : Transform;
var clip : AnimationClip;
function Start () {
	animation.Play(clip.name);
	yield new WaitForSeconds(clip.length);	
	
}

function Update () {
	transform.position = repos.position;
}

Applied the above script on the cube I am animating. repos is the empty game object that I positioned with the cube and clip is the animation clip.

Note : Don’t forget to turn off Play Automatically in animation of the cube (object).