Godot Version
v4.3.stable.official [77dcf97d8]
Question
I have a super simple rigid body (containing 4 collision shapes) + character setup in which I move my character using
extends CharacterBody2D
@export var walk_speed = 50
func _physics_process(delta):
var CV : Vector2 = Vector2.ZERO # character velocity
if Input.is_action_pressed("input_R"): CV.x += 1
if Input.is_action_pressed("input_L"): CV.x -= 1
if Input.is_action_pressed("input_D"): CV.y += 1
if Input.is_action_pressed("input_U"): CV.y -= 1
velocity.x = CV.x*walk_speed
velocity.y = CV.y*walk_speed
move_and_slide()
This works as expected other than in one particular context. In the video below, you can see that the character moves in various directions and slides along the edges of collision shapes as expected…
…until, when I go to the right, reach the shape on the far right and collide with it (so the character starts sliding up as expected), after I let go of the control and I press LEFT, the character continues to glide down along the edge of the collision shape!?
What could be causing this?
Things I have tried:
Changing the collision shape used by the character to circle
Changing the collision shape used by the character to capsule
Using world boundary instead of collision polygons on the left and right side of the room…
etc
Always the same result, once the character touches the far right collision shape it gets glued to it, instead of moving to the left when left is pressed.