Search Unity

Game object moves away after a rotation

Discussion in 'Getting Started' started by Kirill_1984, Jul 29, 2021.

  1. Kirill_1984

    Kirill_1984

    Joined:
    Jun 21, 2021
    Posts:
    21
    Hello, everyone. I am a beginner with Unity3D and have the following question. I got a Tetromino T for tetris game. I made it like: first I got four predefined sprites as squares and then created an empty object so that to put them into it to make an item (Tetromino T). The problem is that when I start rotating it with a gizmo (choosing a rotating tool) everything is just fine, but when I add the value in transform field (for example, 180 degress) it moves quite a bit to the right. I wonder why it happens all the time. Hope somebody knows how to solve this problem.
     
  2. Kirill_1984

    Kirill_1984

    Joined:
    Jun 21, 2021
    Posts:
    21
    Maybe the problem is that pivot point is not in the center, but I cannot open its settings as there is no sprite added to Sprite Renderer. I just cannot copy empty object with four predefined squares as children into Sprite Renderer (it shows refusal).
     
  3. Kirill_1984

    Kirill_1984

    Joined:
    Jun 21, 2021
    Posts:
    21
    If I use a sprite (without four tiles) rotation works just fine. I wonder if I can do the same for an empty object which includes four tiles. Any reply would by much appreciated.
     
  4. Kirill_1984

    Kirill_1984

    Joined:
    Jun 21, 2021
    Posts:
    21
    I was able to solve the problem. I just didn't set an empty object coordinates before I made all the tiles as its children. Now everything is just fine and works correctly.