Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Unity2D - attach transform to a vector point in a moving animation?

Discussion in 'Animation' started by starvetor, Oct 26, 2021.

  1. starvetor


    Nov 6, 2018
    The title is awfully worded but I'm having trouble explaining it concisely. Basically I have a 2D animation of a walking player sprite. The player is holding a torch which rotates and follows the mouse, so I've detached the arm from the sprite so that the animation doesn't include the arm.

    The problem now is that the character bobs up and down while walking, so the attachment point of the arm changes as the animation progresses. The only way I can think of is finding the Y position of the connection point at every frame and hard-coding the position of the arm using animation events.

    Is there a better way to do this? Any help would be appreciated!