Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question How can I make the origin of the parent follow the origin of the child?

Discussion in 'Animation' started by Dan-100, Oct 24, 2023.

  1. Dan-100


    Apr 23, 2023
    Before creating keyframes for this square, the square follows the mouse since I've written that in my code to happen in the game, but then I need this square to have some animations, but as soon as I create a keyframe for its position, the square stops following the mouse as shown below. I haven't even tried to do anything with that animation in my code. You can try this on your own and see if this happens to you too. What is the reason that this is happening?

    I tried to create a parent for the square, and then I made the parent follow the mouse, and I created the animations for the square. The only problem with this approach is that the parent and child would have different origins if the child's position was changed in the animation. What would be the best way to make their origins (gizmo ) the same so that moving the child would make the origin of the parent the same as the child?

    In the top left, there is a "pivot" and "center." When I change both the parent and child to "center," the origin of the parent follows the child, but in the actual game, this does not happen.