Когда я подхожу к блоку и зажимая W + Space получается более низкий прыжок, нежели когда просто нажимаю Space
![67ab0686cd30d476610676.png](https://habrastorage.org/webt/67/ab/06/67ab0686cd30d476610676.png)
using UnityEngine;
public class Player : MonoBehaviour
{
[SerializeField] private float moveSpeed = 1f;
[SerializeField] private float jumpForce = 4.3f;
private Rigidbody rb;
private bool isGrounded;
private InputSystem_Actions input;
private Vector3 movement;
private void OnEnable()
{
input.Enable();
}
private void Awake()
{
input = new InputSystem_Actions();
rb = GetComponent<Rigidbody>();
}
private void Update()
{
PlayerInput();
if (input.Player.Jump.triggered && isGrounded)
{
Jump();
}
}
private void FixedUpdate()
{
Move();
}
private void PlayerInput()
{
Vector2 inputVector = input.Player.Move.ReadValue<Vector2>();
movement = new Vector3(inputVector.x, 0, inputVector.y);
}
private void Move()
{
rb.MovePosition(rb.position + movement * (moveSpeed * Time.fixedDeltaTime));
}
private void Jump()
{
rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
isGrounded = false;
}
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.CompareTag("Ground"))
{
isGrounded = true;
}
}
}