I am trying to implement slopes into my 2D platformer using Godot 3.0.
I currently use move_and_slide()
to update my position since I didn't have any luck designing custom collision response for slopes with move_and_collide()
.
Using move_and_slide()
, I've noticed that my player moves slower proportional to the steepness of the slope. I don't like this.
So, my question: Assuming move_and_slide()
, is there a way to adjust my Player's velocity while on the slope so that his velocity up the slope diagonal is an upwards projection of his would-be horizontal movement, or, alternatively, scaled to this would-be horizontal movement?
I had planned to do this using move_and_collide()
, projecting the velocity remainder onto the collision surface's plane using a normal and Vector2.slide()
, but, like I said, I didn't have much luck. (Ascending slopes worked fine, but I got jittery behavior when descending them, as well as slid down them during idle.) Ideally, I'd like a way using move_and_slide()
.
I know that I can get the collision data (collision normal, remainder, etc.) used in the move_and_slide()
by calling get_slide_collision()
after it. Maybe there is some way to use this data to achieve my desired result?