Search Unity

Z value of rotation problems.

Discussion in 'Scripting' started by HoangPh, Jul 31, 2014.

  1. HoangPh

    HoangPh

    Joined:
    Apr 25, 2014
    Posts:
    18
    So i am trying to make the gun rotate to mouse when click. But one problem is when im not in play mode, i rotate the gun in Z values so its become negative number which i would like to use, but when im rotate it with script (transform.Rotate) in negative Z ,enter Game mode with the same way, it turns to positive value, anyway to fix this?
     
  2. hammil

    hammil

    Joined:
    Jun 5, 2013
    Posts:
    56
    Negative rotations are mathematically equal to positive ones. -90 degrees == 270 degrees, for example. Unity will automatically use the positive variant (mod 360), but this shouldn't have any effect on your code if you're comparing them correctly.
     
    HoangPh and GarthSmith like this.
  3. HoangPh

    HoangPh

    Joined:
    Apr 25, 2014
    Posts:
    18
    OMG thanks alot i figured it out