Гравитация нормально выставлена, если закоментировать строку движения то всё нормально будет
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayeMoving : MonoBehaviour
{
public Vector2 direction;
public Transform transform;
public float speed = 5f;
public PlayerControls playerControls;
public bool isGrounded = false;
public Rigidbody2D rb;
public float jumpForce = 5f;
private void Awake()
{
playerControls = new PlayerControls();
}
public void DirectOn(InputAction.CallbackContext context)
{
direction = context.ReadValue<Vector2>();
}
public void Jump(InputAction.CallbackContext context)
{
if (isGrounded)
{
rb.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
}
}
private void FixedUpdate()
{
rb.velocity = new Vector2(direction.x * speed, direction.y * speed);
}
void Update()
{
//transform.Translate(direction * Time.deltaTime * speed);
//rb.MovePosition((Vector2)transform.position + (direction * speed ));
}
private void OnCollisionExit2D(Collision2D coll)
{
if (coll.gameObject.CompareTag("Platform"))
{
isGrounded = false;
}
}
private void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.CompareTag("Platform"))
{
isGrounded = true;
}
}
}