Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

EulerAngles.x says 90, but it's clearly not?

Discussion in 'Scripting' started by Desprez, Jul 10, 2014.

  1. Desprez

    Desprez

    Joined:
    Aug 31, 2012
    Posts:
    305
    I've got an object and when I rotate it in-game, or in the editor there seems to be a dead zone around 90 degrees.

    It moves smooth, but the inspector displays the wrong values - it seems to just say 90 when within a couple degrees.

    No other axes are changing. From about 88-92 degrees the inspector remains at (90, 0, 0)

    Since I have a script that does things based on this angle, it doesn't work properly in the dead zone.
    How do I work around this?
     
  2. Arunraj

    Arunraj

    Joined:
    Jul 4, 2012
    Posts:
    21
    mostly unity engine will update the values (rotation - here) immediately to the editor. Some cases it may have a delay. even though if its updating we can't see the changes if its is changing over seconds!
     
  3. Desprez

    Desprez

    Joined:
    Aug 31, 2012
    Posts:
    305
    I'm not sure what you mean.
    I can have the object resting at 88 degrees, both in the editor and in-game, and the inspector (and in code) reports 90.
    Since it's just sitting there, it's had plenty of time to update to the proper value.
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,748
    Huh. I've never noticed this before, but I can reproduce it - just make an object and start dragging the X axis rotator, and indeed, when it's near (90,0,0) it just rounds it off. It appears to be unique to the X axis, too.

    File bug report, I guess. As for a workaround - Could you possibly use transform.forward and Vector3.Angle to figure out the true angle when it's in this zone?