Search Unity

How to align Axis parallel to horizon (X,Z plane) for rotating using AngleAxis method

Discussion in 'Scripting' started by DaKocha, Apr 5, 2014.

  1. DaKocha

    DaKocha

    Joined:
    Oct 7, 2012
    Posts:
    28
    A question with identical title has been asked at unity answers, but no one has dropped a single word. So I'm trying again here in the forums.

    The question is - How do I calculate the Axis on the spine bones so that when I rotate using AngleAxis(), it Pitchs' along the horizon without messing along the roll? E.g, when I look up/down, the arms dont roll side to side or yaw along, only pitch up/down. Here is a picture of the situation, on the left, the arms along with the gun just rolls clockwise when I look up, I use AngleAxis() to rotate the spine bone. On, the right is a simulated situation of the desired effect. So, please help me! $SpineAim.jpg

    I dont want to spam ofcourse, but I'm desperate!

    Regards.