Player getting stuck on an edge of a moving platform

lonskynelonskyne Posts: 7Member
edited February 11 in 2D

Hello, I'm working on a game and have a vertically moving platform on it (the statue in the video), it's a kinematic body but tried with a static body and it's the same. I directly change it's position so the player can be moved with it (can't use move_and_slide). The problem is the player sometimes gets kinda stuck on the edge if the platform is moving and his jumps don't reset (i have a double jump in the player and only one jump remains even though he stands on the platform for a moment). Here's the code that's moving the statue (in _physics_process):
if is_on_button: if position.y < min_down: position.y += speed * delta elif position.y > max_up: position.y -= speed * delta

Here's a video so you can see whats the problem: https://imgur.com/a/i7bIs4D

EDIT: I tried a lot of things to pinpoint why it happens. It stops happening if I switch the player collider from a capsule to a rectangle, I would rather not have a rectangle collider so can I fix it with keeping the capsule collider?

EDIT 2: With more research I found this post on the forums about a similar problem and the person also figured that when they switch to a rectangle, the problem goes away.


Tags :

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file