- Home /
C# Make Child Not Animate Looped Animation
I have a gameobject with several other gameobjects parented to it. I would like to make the children gameobjects not animate along with the parent gameobject. It's a looped animation and I also want the children gameobjects to remain parented to the parent gameobject. Is there a way to tell a gameobject to never animate or make the parent gameobject not include the children within it's animation? I have some pseudo code down below. I have an idea what I'm looking for. I'm just not sure what it would be called.
void Update(){
//Gameobject.animate = null;
//or
//ParentGameobject.animateChildren = false;
}
Answer by Mmmpies · Aug 03, 2014 at 08:40 PM
That's not very clear. So I'm going make some big assumptions here.
Assumption 1: You've connected a child object to a parent somewhere on that parents "body".
Assumption 2: When the parent animates the children you setup move around, a bit like a sword in a hand they follow the hands location.
If that's right then you need to set the transform of the children to be relative to the transform.position of the parent but not of the transform.position or transform.rotation of the "body parts".
Like I said it's not very clear but it's all I could think of without extra information.
If I'm right create empty GameObject points that are directly under the main parents and not attached to limbs etc.
You may have to set the rotation to only be affected by one plane (x, y or z) depending on how your game is setup. Anyway more information would help.