Search Unity

Changing rotation angle in 2D unity3d project

Discussion in '2D' started by AlexeyMalyuk, Apr 23, 2015.

  1. AlexeyMalyuk

    AlexeyMalyuk

    Joined:
    Apr 23, 2015
    Posts:
    1
    On scene we have platform with BoxCollider2D.
    On platform we have triangle with PolygonCollider2D and Rigidbody2D.
    h_1429616499_5281094_e6cc81c5dc.png
    At startup our triangle falls and fall on one side, and parameter Transform-> Rotation-> Z changes.
    h_1429617560_7153906_601b577317.png
    I'm making the controller for this triangle(at future it will be a plane). When I press UpArrow button, I checking is grounded my plane or in "air", and if it's on ground - rotation->z chages to 0 degrees that is parallel to the platform and move to the right with speed (_speed = MaxSpeed / 2). I can't turn my triangle and move right, please help me, I can't find answer for my question at least 3 days.
     
  2. TomasJ

    TomasJ

    Joined:
    Sep 26, 2010
    Posts:
    256
    How are you moving the triangle? If you rotate it back to 0, physics will just cause it to fall down (rotate) again.
    You might want to disable the rigid body when a button is pressed.