Search Unity

Question How to tilt the entire upperbody up or down, whilst facing a direction?

Discussion in 'Animation' started by TragicallyCanadian, Sep 18, 2023.

  1. TragicallyCanadian

    TragicallyCanadian

    Joined:
    Mar 26, 2020
    Posts:
    39
    Hello there.

    Desired Functionality

    I essentially want to make the characters upper body face the direction of its attack by how much you are looking up or down. Basically, if you look up and swing you swing towards the air above you, if you look down you swing towards the air below you.

    Like this
    Now this works, but not for EVERY animation. I have problems for some of my attack animations.

    https://gyazo.com/fbe09f7af473d1fc41b7cf7b55b2d9a6


    This one does not work
    As you can see the first attack is played without looking up or down, and it thrusts forward as intended, however when I look up the thrust is diverted to the side and does not stay centered.

    https://gyazo.com/06f985657c023910b015644537b74762



    I think this is happening because with some of my attack animations the spine isn't always facing forward towards its target, so when rotating the spine to face up or down the animation can be offset to face the incorrect direction. My question is, how would I go about achieving the desired result? Currently I am doing this with some simple code. Here is a quick snippet.

    upload_2023-9-18_18-24-28.png
     

    Attached Files: