My character works fine with slopes and etc. But when i my character try to walk through a angle that is above 90 degrees (like in this curve, for example), my character gets stuck.
Arthuralgum
1d
Godot Version
Godot Engine v4.4.1.stable.steam.49a5bc7b6
Question
My character works fine with slopes and etc. But when i my character try to walk through a angle that is above 90 degrees (like in this curve, for example), my character gets stuck.
My movement code:
if player.is_on_floor():
floor_angle = player.get_floor_angle()
slope_factor = clamp(cos(floor_angle), 0.4, 1.0)
rot = floor_angle
player.velocity.x = motion.x * (1 + -0.5 * player.get_floor_normal().x)
player.velocity.y = motion.y * (1 + -0.5 * player.get_floor_normal().y)
if direction and !control_lock:
if player.is_on_floor():
if (direction > 0 and motion.x >= 0) or (direction < 0 and motion.x <= 0):
if abs(motion.x) <= topspeed:
motion.x += acc * 0.25 * direction
else:
motion.x = topspeed * direction
else:
motion.x += 0.25 * direction * delta * 120
else: # If mid-air...
motion.x += (acc) * direction * delta * 60
And my CharacterBody3D max angle is 180 degrees. Does anyone know a way to solve this problem?