Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Help pls

Discussion in '2D' started by Aykutbakar, Feb 11, 2021.

  1. Aykutbakar

    Aykutbakar

    Joined:
    Dec 12, 2020
    Posts:
    21
    hi guys

    I want the direction of the gun to change when I turn, but I could not rotate it.

    right side;
    upload_2021-2-11_15-41-21.png

    Left side;
    upload_2021-2-11_15-41-40.png

    and code

    upload_2021-2-11_15-42-3.png
     
  2. raarc

    raarc

    Joined:
    Jun 15, 2020
    Posts:
    535
    Code (CSharp):
    1. transform.localscale = new vector3(-1,0,0)
    and also center pivot point on middle
     
    Vryken likes this.