Sliding along ramps in a "wave-like" side-scroller

Currently recreating the wave/dart mode from Geometry Dash like in this video at 0:13 in Unity.


Simply put, the player navigates through ramps and slopes by holding down the mouse button to go up at a 45 degree angle. If they are not holding, they go down at a 45 degree angle.


The problem that I have is that I want the player to have the ability to slide up these ramps too without having to press anything. For example:
2 (the red square is the player, the white line is his trail, and the pink arrow is how he should be sliding upwards)


The player should be able to just slide up the ramp without having to hold down the button.

After many failed attempts at trying to set the player’s rigidbody velocity to go upwards along with the ramp via OnCollisionEnter2D, I am still trying to find a way to implement this sliding without the player colliding with the ramp and therefore offsetting it by a few pixels.


Player code (without any sliding):
Player.cs


Player’s rigidbody component:
rb2d


Without any sliding implemented, the player just simply slams his head into the ramp and doesn’t go up, and gets left behind by the scrolling camera.
Video: 5


Any help would be appreciated, cheers!

Note: I’m able to attach the project files if need be!

There are a couple alternatives here. The simple workaround might be to uncheck freeze rotation z and let physics do its thing. Alternatively, you could set the speed of the block so it goes over the ramp. First you make the ramp’s collider a trigger. If ramps have different slopes, you could either make the player object multiply its speed by the ramp’s angle so it follows a correct trajectory. Here is an example

    public Vector2 angleToVector(float angleToUse)
    {
         // this is a function I created myself to use in various projects :)
        angleToUse *= Mathf.Deg2Rad;
        return new Vector2(Mathf.Cos(angleToUse), Mathf.Sin(angleToUse));
    }

OnTriggerEnter2D(Collider2D col)
{
     float angle = col.gameObject.GetComponent<RampScript>().angle;
     // Get the angle of the ramp in some way
     rb2d.velocity = angleToVector(angle) * speed;
}

Or, a better way to do this might be to get the position of the upper and lower points of the ramp, and when OnTriggerEnter2D is called, store them both as Vector2s and use Mathf.Lerp to Lerp the position of the playerobject between the lower point Vector2 and upper point Vector2.

Either way, you gotta find a way to obtain the ramp’s angle or upper and lower points.