Код: Выделить всё
using UnityEngine;
public class Movement2 : MonoBehaviour
{
[Header("Movement")]
public float Speed = 4f;
public float jumpPower = 3f;
private Rigidbody2D rb;
private GroundCheck gr;
private float horizontal;
private void Start()
{
rb = GetComponent();
gr = GetComponent();
}
private void Update()
{
horizontal = Input.GetAxisRaw("Horizontal");
if (gr.grounded == true && Input.GetButtonDown("Jump"))
{
rb.velocity = new Vector2(rb.velocity.x, jumpPower);
}
}
private void FixedUpdate()
{
rb.velocity = new Vector2(horizontal * Speed, rb.velocity.y);
}
}
Я не знаю, как это исправить .
Подробнее здесь: https://stackoverflow.com/questions/787 ... ith-a-wall