- Home /
Using the same animation on duplicate objects.
I'm animating ducks swimming in a pond. I successfully animated the duck's circle of movement. I have duplicates of the same duck and I want to attach the single animation to all the ducks and move them in different areas of the pond.
When I run the animation they all clump to the spot I animated them instead of running the animation where I placed them. I've tried adding an empty game object, zeroed out the translation and parented the duck objects to the empty game object but they still clump to one spot.
Is there anything I can do to fix this? Or do I have to make unique animations for each duck?
Answer by trs9556 · Dec 31, 2013 at 02:48 AM
I might struggle with explaining this but I think I know what is happening.
So when you created the animation you probably animated the top parent of your gameobject. Thus "hard coding" what the x y and z chordates of where the animation will take place. So for example if your ANIMATION starts at 0,0,0 and ends on 5,5,5 it doesn't matter if your gameobject starts at 8,8,8 as soon as the animation begins it will jump to 0,0,0.
This holds true for any gameobject using this animation.
The way I get around this is I create an empty gameobject and parent it to whatever I want to animate. Therefore you are animating the x y and z of the child so it's chordates will revolve around whatever the parent is.
You can then stick your parent object anywhere you want and the child will animate in relation to the parent's location.
you are right and that is what I did. more over, I created a prefab of the empty game object that includes my animated game object and all animation is working cool as wanted. thanks!
Answer by ash22 · Jun 07, 2016 at 06:30 AM
Right on man - solved my issues - at least with position animations - THANKS