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

Question How Do I Flip Firing Point Along With Player?

Discussion in '2D' started by tr1s, Aug 13, 2023.

  1. tr1s

    tr1s

    Joined:
    Aug 6, 2023
    Posts:
    2
    Hello, I am having problems figuring out how to flip the firing point along with my player

    This is how I am currently flipping my character...
    if (dirX > 0f)
    {
    state = MovementState.running;
    sprite.flipX = false;
    }
    else if (dirX < 0f)
    {
    state = MovementState.running;
    sprite.flipX = true;
    }
    else
    {
    state = MovementState.idle;
    }
     
  2. Dedi6

    Dedi6

    Joined:
    Jan 20, 2019
    Posts:
    119

    Flipping the sprite like you did only flip the sprite of the player, nothing else.
    Flipping the Transform of the player will cause it and it's children to change. (I assume your fire point is a child of your player)

    So, just change the Transform instead, something like that:

    Code (CSharp):
    1. transform.Rotate(0.0f, 180.0f, 0.0f);
     
    tr1s likes this.