I’ve been working on a 2D Platformer game in Unity using Raycasts for collision detection. So far everything is working fine, including slope detection. I’m not using any rigidbodies or physics, but I would like to emulate some slope physics. I’m just not sure how to go about doing it.
Basically what I want to do is make it so when the player is running down a slope, they will move faster, and when going up a slope, slower. After running downhill, I’d also like the player to also keep some of that momentum and keep running at that pace for a time. Right now, I have calculated the angle that the player is currently moving on using Raycasts, but I’m a bit confused on where to go from there. I’ve always been terrible at trigonometry.
Maybe someone can point me in the right direction?