- Home /
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.
Answer by Murtaza-Learner · Apr 02, 2013 at 11:42 AM
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).
Your answer
![](https://koobas.hobune.stream/wayback/20220613095534im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
animation & position problem 0 Answers
Keep position after animation End? 1 Answer
Syncing object's coordinate position with object's animation position. 3 Answers
Unity 3 Animation Positioning Problem 1 Answer
Change camera position 1 Answer