Search Unity

Weird Issue - Solved

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

  1. Zero_Xue

    Zero_Xue

    Joined:
    Apr 18, 2012
    Posts:
    116
    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:
    116
    Last edited: May 8, 2016