Composite collider and IsTouchingLayers

Compared to the lecture, I actually checked the box “Used By Composite” don’t the “Climbing Tilemap”, as I expect this was the intention. However, I found out that if I stand in the middle of the ladder (the player’s collider is completely inside the ladder’s collider) the player just jumps when pressing the Up/W key. I expect that this is because of how the “IsTouchingLayers” method works. My guess is that if the player’s collider and the ladder’s collider are inside one another, but none of their edges are touching “IsTouchingLayers” returns false, even if I’m technically on the ladder. Any advice on a solution?

Hi,

Welcome to our community! :slight_smile:

A common problem with the ladder is that the gap between the two vertical collider edges is too wide. The player moves in the edge, which is just a thin line. Make sure he always touches one of the two edges while climbing.

To edit the collider shape, click on the sprite in your assets folder, then on “Sprite Editor”. You want to edit the “Physics Shape”.

Did this help you fix the problem?


See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms