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. Dismiss Notice

"Local" Y & X Euler axis NOT local, and my question was deleted

Discussion in 'Editor & General Support' started by krayzie762, Feb 21, 2015.

  1. krayzie762

    krayzie762

    Joined:
    Aug 21, 2014
    Posts:
    3
    My "Local" axis's are not acting appropriately, the X and Y axis's are never local, and yet the Z axis is. I posted this in the Answers section and my question got deleted, it said if i thought this was in error to contact support so that's what i am trying to do. A video of this problem is below:

    https://drive.google.com/open?id=0B5WCaxeydU_2WEJ5NUtMNjBKOVU&authuser=0
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Except this isn't support, it's the community forum for general issues.

    Looking at your Answers post (using a different user-name, which is odd) it's just not clear enough. Rotating a 3d object about 3 axes is pretty confusing. What kind of rotation are you after?
     
  3. krayzie_762

    krayzie_762

    Joined:
    Feb 21, 2015
    Posts:
    5
    well it was a different user name, because this site made me create a new one just to post here... also it told me if i felt they closed my post in error to contact support, then i found out that support you have to pay for.

    Anyways, i am trying to rotate wheels from script. At first i realized that no matter what axis i would rotate the wheels on, it would never get the correct axis, looking into this further, i realized that the "Y" axis, and the "Z" axis, produced exactly the same rotation. I then realized that because the "Y" axis was now pointing sideways, it wasn't rotating on "Y" but instead rotating in the world "Y". Then i realized that the only axis that stayed true to local rotation is the "Z" axis.
     
  4. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,952
    The video you posted shows the proper behavior. The rotation in the inspector is relative to the parent (which with a new object is the world)

    The wheel you are trying to rotate, is it attached to, or connected to something?
     
  5. krayzie_762

    krayzie_762

    Joined:
    Feb 21, 2015
    Posts:
    5
    Yes it is attached, but how exactly is that proper behavior? The "Z" axis is local to the object itself no matter what, and yet the other 2 are always world, there's no consistency either they should all be world or all local. How is no one getting the point?
     
  6. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,952
    The transform panel values are not "local" they are relative to the parent. If you want to rotate locally use the rotation handles by selecting the rotate tool.

    If it is attached to something with a joint or script or something like that (considering it is a wheel), the rotation/movement may be limited by that.
     
    BBeck likes this.
  7. krayzie_762

    krayzie_762

    Joined:
    Feb 21, 2015
    Posts:
    5
    Then why is the Z axis "local"? you can clearly see that in the video

    Also i'm not going to be rotating wheels with handles it will all be done by script, hence why i use the inspector in the video

    Its just annoying when i'm trying to rotate a wheel and i physically cannot, just because i cannot access the right axis, the Y and Z literally give the exact rotation
     
  8. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    The support they wanted you to contact is support@unity3d.com, not the paid support.
     
  9. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,952
    Again, the transform inspector is ALWAYS relative to the parent. It doesn't matter if you have the axis set to local or global, it does not use the axis, the axis is for when you are using the too. If you use the rotate tool, it will rotate around visible axis. (local or global, depending on which you have set.)

    If you are rotating them via script, rotation (or eulerAngles) will rotate it globally. localRotation (or localEulerAngles) will rotate it relative to the parent. (similar to what you see in the inspector).
     
  10. krayzie_762

    krayzie_762

    Joined:
    Feb 21, 2015
    Posts:
    5
    Your CLEARLY not understanding the problem.... everything you are saying i already know. There's 3 Axis's... x,y, and z. These 3 axis's whatever they are (local or global) should all agree with each other. And yet they do not. 2 of them are global and 1 is local. AT THE SAME TIME
     
  11. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,952
    I don't how else to explain it to you. All rotation from the panel is relative to parent. Exactly as in your video. None of them are rotating locally. When you drop a primitive in an empty scene, both the primitive and the parent have a null rotation, so any rotation you make will appear to be local because they are both the same.

    Do this, click on the axis display button:
    Screen Shot 2015-02-25 at 12.44.27 PM.png
    so it changes to global
    Screen Shot 2015-02-25 at 12.44.18 PM.png
    It may help you better what is going on.

    In your video, every rotation you are making is global. The first rotation is global, it only looks local because they are aligned. Again, if you want to local rotation click on the rotation tool with local selected:
    Screen Shot 2015-02-25 at 12.52.24 PM.png
    You will then be able rotate exactly the way you want. (though the numbers in the transform panel will not match, because they are still relative.)
     
    Graham-Dunnett likes this.
  12. krayzie_762

    krayzie_762

    Joined:
    Feb 21, 2015
    Posts:
    5
    I wasn't talking about the first rotation, that's obvious as it is aligned with world rotation starting off. Tell me this, is the 2nd or 6th rotation global or local?
     
  13. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,952
    Ok, I see why you are confused None of them are local, they are euler, based on the parent. The z may appear to look "local", but it is not. It is euler.z, it is just the last angle to calculated. Numbers in the inspector are not 360 degree of each axis, they are euler (http://en.wikipedia.org/wiki/Euler_angles)

    Because it is a rotation, you can't set local values for each axis arbitrarily and have them come out as you expect, as they affect each other. in x>y>z order. you can use Rotate a alter a value on axis, so if you want to rotate on the local z you can do Rotate(vector3.forward * speed, Space.self. That will rotate on the z.

    But as they are all related, bear in mind that if x and y aren't 0, they will be constantly changing as well.
    For example if you have a euler of 0,0,0 and rotate "locally" on the z, it will be 0,0,90
    Bu, if you have a euler of 90,90,0 and rotate it "locally" on the z, it will now be 90,0,0 and so on. You don't want to directly manipulate the values, it is best to use Rotate or similar.