#Velocity2D

1 messages · Page 1 of 1 (latest)

rustic nova
#

I have this movement cs rb.velocity = new Vector2(moveInputX,rb.velocity.y);

#

This for jumping

if(Input.GetKeyDown(KeyCode.Space) && isGrounded) {
    rb.velocity = new Vector2(rb.velocity.x,jumpForce);
}

if(Input.GetKeyUp(KeyCode.Space) && rb.velocity.y > 0) {
    rb.velocity = new Vector2(rb.velocity.x,rb.velocity.y * 0.01f);
}```
#

And the problem becomes at the Jump in the keyup function

#

Like it sometimes dosnt care about it even If I press short time

#

Basically what it does its jump by a certain velocity and limit the velocity to cmake the object fall if you stop clicking early

#

I think setting the velocity to many times its ruining it but Idk

#

I think I fixed it putting all in Update instead for FixedUpdate but why it is supposed to be better fixed update for physics