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!