// Update is called once per frame void Update() { onGround = OnGround(); float horizontal = Input.GetAxisRaw("Horizontal"); float vertical = Input.GetAxisRaw("Vertical"); Vector2 move = new Vector2(horizontal, vertical); move.Normalize(); Vector2 targetVel = rigid.velocity; //if(onGround) //{ if (Input.GetButtonDown("Jump")) { targetVel.y = jumpForce; } //} targetVel.x = movementSpeed * horizontal; rigid.velocity = Vector2.Lerp(rigid.velocity, targetVel, 0.8f); if (prevOnGround != onGround) { if (onGround) { cameraMovement.AdjustYrelativeOffset(-1.2f); } } prevOnGround = onGround; }