KinematicBody2D with multiple CollisionShape2D get stuck passing through one way collision

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Essojadojef
:warning: Old Version Published before Godot 3 was released.

I made a character with 3 CollisionShape2D ( “head”, “body”, “legs” ) and made it can jump through an one way collision platform.
As long as the player pass the platform entirely there are no problems.

But if the character stop jumping while it hasn’t step over the platform with its legs, it will fall and get stuck when its body or head CollisionShape2D touch it.
How can I solve this?

The image below show the character’s CollisionShape2D
Image of the collision shapes

Also, the platform is a StaticBody2D which is in the second layer only, while other StaticBody2D are in the first one and the character’s mask is in both. I haven’t found a way to set the head and body to be in the first mask only.

I am getting this exact problem except I’m using a collisionpolygon2D for my player

drakesmith | 2020-04-14 19:00

:bust_in_silhouette: Reply From: eons

Is a design issue, you have 3 shapes for the floor, looks like they are different bodies for different use.

Is always better to have a single (and simple) shape for general collision, and different bodies/areas for other uses like hitboxes.


To keep it like this, I would make an Area over the 2 lower parts, if that Area is over a floor, move the main body a bit up (a raycast may be better, not sure).