Kinematic Body on slopes issues

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gamepro5

I have what I like to think is a pretty good move system. But when it comes to slopes that fall under the definition of floors, I run into issues. I was able to fix one of them by checking if I am on the floor before move_and_slide_with_snap() so I won’t snap on things that are slanted walls. My current solution doesn’t even work for all angles, but that is besides the point, hopefully it would get fixed along with the main issue.

I have a 45 degree slope in my game. The expected behavior would be that you stick on the slope and don’t hop around when going down it which i have fixed with move_and_collide_with_snap(). However, this still leaves 2 other problems. I want to not slide down slopes, and I want to travel at the same speed, as if I was on the ground, when going up and down slopes that count as floors. The “stop_on_slope” parameter of move_and_slide() doesn’t work because the character is supposed to continue for a while with the friction and acceleration I have implemented as a simple constant multiplicative factor. After sliding with friction the player does stop on the slope but you don’t slide up the slope with the friction if you were going up it before letting go of your key. It is hard to describe but hopefully trying it out for yourself will provide better insight. I have been struggling with this for about 4 weeks now and it is driving me nuts.

Current code for the player

Builds for trying out the issue

:bust_in_silhouette: Reply From: Noise

Have you tried setting the slope angle to 46? The floating point error can be what is causing the issue.