Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Weird Issue - Solved

Discussion in 'Scripting' started by Zero_Xue, May 7, 2016.

  1. Zero_Xue

    Zero_Xue

    Joined:
    Apr 18, 2012
    Posts:
    120
    Hi there, this is probably something really stupid am just not seeing but am having a issue.

    for some reason Back,Left and Down are refusing to register even thou the block rotations are correct
    I should point out that the blocks are children of another object hence the use of Local rotation.

    I find it weird that Forward,Right and Up are all working correct.

    Please help my head hurt.
    Thanks in advance =)

    Code (CSharp):
    1.         Debug.Log(Block.localRotation.eulerAngles.y);
    2.         if (Block.localRotation.eulerAngles == new Vector3(0,0,0)) // 1 - Forward
    3.         {
    4.             ThrustForward += Thrust;
    5.         }
    6.         if (Block.localRotation.eulerAngles == new Vector3(0,180,0)) //2 - Back
    7.         {
    8.             Debug.Log("YAY");
    9.             ThrustReverse += Thrust;
    10.         }
    11.         if (Block.localRotation.eulerAngles == new Vector3(0, 90, 0)) //3 - Right
    12.         {
    13.             ThrustRight += Thrust;
    14.         }
    15.         if (Block.localRotation.eulerAngles == new Vector3(0, 270, 0)) //4 - Left
    16.         {
    17.             Debug.Log("YAY");
    18.             ThrustLeft += Thrust;
    19.         }
    20.         if (Block.localRotation.eulerAngles == new Vector3(0, 0, 90)) //5 - Up
    21.         {
    22.             ThrustUp += Thrust;
    23.         }
    24.         if (Block.localRotation.eulerAngles == new Vector3(0, 0, 270)) //6 - Down
    25.         {
    26.             ThrustDown += Thrust;
    27.             Debug.Log("YAY");
    28.         }
     
  2. destructivArts

    destructivArts

    Joined:
    Jan 30, 2013
    Posts:
    29
    Can you post your Debug Log? Might help
     
  3. Zero_Xue

    Zero_Xue

    Joined:
    Apr 18, 2012
    Posts:
    120
    Last edited: May 8, 2016
unityunity