- Home /
Play animations to different objects
Hi, I would like to know how to apply animations to different objects. Let's say, there are ModelA which has no animations, and ModelB which has animations, How do I apply ModelB's animations to ModelA by script?
Thanks
Depends. How similar to $$anonymous$$odelA is $$anonymous$$odelB? It may be possible, but then again it might not be.
$$anonymous$$odelA and $$anonymous$$odelB have the same stracture. Is it possible?
Answer by luizgpa · Jan 17, 2012 at 12:25 PM
First add the desired AnimationClip from B to A, and them play it
objA.animation.AddClip(objB.animation["anim01"].clip, "anim01");
objA.animation.Play("anim01");
If you want to add all the clips
for (var state : AnimationState in objB.animation) {
objA.animation.AddClip(state.clip, state.name);
}
Answer by RyohTazaki · Jan 19, 2012 at 02:31 AM
Thank you!
You're welcome. But you should thank on a comment ins$$anonymous$$d of creating a new answer ;)
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Play animation once 1 Answer
Play animation for horizontal and vertical movement? 1 Answer
Mixamo Call Animation from Script 0 Answers
Adding animation clips via script 2 Answers