Search Unity

How to flip character direction using bolt

Discussion in 'Visual Scripting' started by Shatt3r, Feb 16, 2021.

  1. Shatt3r

    Shatt3r

    Joined:
    Feb 14, 2021
    Posts:
    1
    I'm currently experimenting with bolt in a 2D platformer. I've tried a few different ways (transform set forward, different vectors, sprite renderer) but I cannot figure out how to make it work. I read somewhere that sprite renderer can flip the x direction, but it seems no matter where I attach it into my move logic the characters direction never flips. I'm very new to all of this and just started yesterday the tutorials I've watched are either outdated and no longer work or they are for 3D games where what they demonstrate doesn't work on my 2D game.
     
  2. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    If you are using sprite Renderer component on your character, you can simply change the scaling of your character from 1 to -1 with a Set Local Scale node.
    upload_2021-2-16_0-18-16.png
     
    Haneferd likes this.
  3. Haneferd

    Haneferd

    Joined:
    Feb 3, 2018
    Posts:
    36
    You can also use the flip sprite setting within a simple movement script. I have made some logic screens below, but it is on Unity 2021.1 beta 5 (Since I am trying to learn visual scripting myself :) ). If using Bolt, you need to replace "If" with "Branche". And, if you want to use the movement script, you need to change the vector2 from "create" to "new" in Bolt.:
    upload_2021-2-16_13-46-1.png

    Full screen with sprite render here, if needed:
    upload_2021-2-16_13-47-30.png
     
    ericb_unity likes this.
  4. bucket_of_souls

    bucket_of_souls

    Joined:
    Jan 3, 2022
    Posts:
    24
    this thread is like a year old, but the script doesn't work. Do you need to have that exact movement script? or flowchart or whatever
     
    Last edited: Mar 29, 2022