не работает поворот гг персонажа в зависемости от движения вправо или лево. делал по видео из ютуба

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playerScript : MonoBehaviour
{
    public float speed = 10f;
    public float jump = 5;
    public float moveInput;

    private bool fanticRight = true;

    private Rigidbody2D rd;

    private void Start()
    {
        rd = GetComponent<Rigidbody2D>();
    }

    private void Update()
    {
        moveInput = Input.GetAxis("Horizontal");
        rd.velocity = new Vector2(moveInput * speed, rd.velocity.y);
        if (fanticRight == false && moveInput > 0)
        {
            Flip();
        }
        else if (fanticRight == false && moveInput < 0)
        {
             Flip();
        }
    }
  
    void Flip(){
        fanticRight = !fanticRight;
        Vector3 Scaler = transform.localScale;
        Scaler.x *= -1;
        transform.localScale = Scaler;
    }
}

Ответы (0 шт):