- Home /
Need help with parenting!
I'm trying to create a simple stickman and animate him, so i did what i used to do before when i want a object to rotate around a point(in this case a leg). I would create an empty game object, place it where i want the rotation point to be, add the leg as it's child and then just rotate, but now when i add the leg as a child it just sets the center of the entire object (empty game object + leg) somewhere in the middle. It used to work fine but all of a sudden it doesn't. Please help, cheers.
your method should work fine. remember that unity often changes the gizmo location to somewhere unexpected but as long as you punch n the rotate values on that emptyGameobject in the inspector it should work. i.e. don't let the gizmos location fool you
By what means are you rotating the object (animation, $$anonymous$$echanim, script, joint, etc.)? What does your set-up look like?
Extending what Xander said, adding certain components to an object can affect the scene gizmo's position. The scene appears to draw the gizmo at the centroid of the game object and all such components. For example, if you add a LineRenderer component, the vertices of the LineRenderer seem to affect the scene gizmo position.
However, transform children do not seem to affect the parent's gizmo placement.
You will need to pay special attention to the transform of the parent and of the child. Child is relative to the parent, e.g. a 0,0,0 child will be exactly where the parent is. Often there are surprising results when using positional information and then changing the heirarchy.
Can you be more explicit about exactly what is happening versus what you want to have happen?
"Extending what Xander said, adding certain components to an object can affect the scene gizmo's position" that is happening, and because of that i cannot animate it properly, since it rotates around the gizmo and what i want is to keep the gizmo of the parent where it was originally, not at the centroid. It used to be like that but it changed for some reason. If needed i can post a screeenshot
Ah never$$anonymous$$d, i figured it out :D There was a button that said "Center" and i switched it to "Pivot" and now i'm cool :) thanks for the help anyway :)
Your answer
Follow this Question
Related Questions
[Solved] Animation destroying along with the GameObject its a child of 1 Answer
Can I add a parent to all the children in an animation tree structure ? 0 Answers
Animation precision? 0 Answers
Can I make animations snap to a frame? 1 Answer
My child move with the parent but can't move on it when the parent is moving 3 Answers