Search Unity

Translating camera rotation correctly into quat from two different objects?

Discussion in 'General Discussion' started by Zebbi, Sep 5, 2019.

  1. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    196
    For a first-person camera I'm controlling the x rotation of the camera directly, but I'm controlling the y rotation on a parent object that orbits the player at a distance, this way I don't have to rotate the player capsule collider and it's safer for collisions. I'm trying to translate this to second skybox camera that rotates the same way, but when I look up and down, the skybox tilts, and I think it's because the W angle is not correct when I combine the two different object angles. Is there some way of stopping this odd tilting?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,417
    You really need to show us your exact setup of cameras.
    What is your GameObjects hierarchy related to cameras and which scripts are affecting cameras. Otherwise it can be so many things.

    My best bet is, you got angles/quaternions addition/ multiplications incorrectly.
     
    angrypenguin and frosted like this.
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,028
    There's a fundamental misunderstanding here, because the components of a quaternion are not angles.

    If you're trying to do something in terms of angles then you can read out the (euler) angular components and use them to do what you need to do.