private void AppplyGravity()
{
bool falling = velocity.y < 0f || !Input.GetKey(KeyCode.Space);
float multiplier = falling ? 2f : 1f;
velocity.y += gravity * multiplier * Time.deltaTime;
velocity.y = Mathf.Max(velocity.y, gravity / 2f);
}
private void GroundedMovement()
{
velocity.y = Mathf.Max(velocity.y, 0f);
jumping = velocity.y > 0f;
if (Input.GetKeyDown(KeyCode.Space))
{
velocity.y = jumpForce;
jumping = true;
}
}
I’m trying to do this with with button but couldn’t figure out how
tried to implement new input system but it’s event based and need directly event method but mine is not and need few statement
New contributor
Blinkz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.