Best way to make a physics engine allow player to walk up stairs?

I have a physics engine that I want to allow the player to walk up stairs. right now, I have a raycast that sort of checks in front if there’s a step and enough room to walk up it, but it looks choppy since the player technically “teleports” up stairs, even with a delay it looks strange. How did starbound/terraria do it? I considered ramps but it just didn’t work.

Try this: note that the stairGroundY and stairTopY float values might have to be gotten differently depending on how you have your stairs set up. (This example assumes that the bottom of the staircase is the transform.position.y, not the top)

void OnTriggerStay2D(Collider2D c)
{
    if(c.gameObject.tag == "Stairs")
    {
        Vector3 sPos = c.gameObject.transform.position;
        float stairGroundY = sPos.y;
        float stairTopY = sPos.y + c.bounds.size.y;
        Vector3 pPos = transform.position;

        float xPosRatio = (pPos.x - sPos.x) / c.bounds.size.x;

        float yValueOnStairs = Mathf.Lerp(stairGroundY, stairTopY, xPosRatio);
        transform.position = new Vector3(pPos.x, yValueOnStairs, pPos.z);
    }
}

You can try that out - this is all from the top of my head so it may be flaky. Just comment if something doesnt work.