0 votes

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 moveandslidewithsnap() 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 moveandcollidewithsnap(). 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 "stoponslope" parameter of moveandslide() 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

in Engine by (52 points)

1 Answer

0 votes

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

by (18 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.