Prevent object (character) sliding down slope

Hello,

I have a 2D project using Tilemap. I want to stop my character who has a dynamic rigidbody from sliding downhill when he reaches a slope.

However when I add a physics material with some friction to either my player or the composite collider for my tiles the player comes to a dead stop at the bottom of the slope - and can’t go up.

Can anyone help me with what I’m doing wrong?

Thanks

Hi,

Is the rope on a separate tilemap layer or on the same as the ground?

Hi @Nina ,

It’s on the same tilemap layer as the ground. I have a foreground layer + a background layer.

I have also tried to use raycast to detect when the character reaches a slope and change the friction accordingly however still encounter the same issue.

Check the collider shape. Maybe there is an issue.

When the player gets stuck, pause your game and check the colliders in the scene view. Maybe you will spot an issue.

@Nina

This is where the circle collider snags on the tile, I’ve checked the tile’s physics shape. I’ve tried a few different collider shapes. I’m using a composite collider for the tilemap.

Not sure what else to try.

Capture

Also mark the foreground so we can see the tilemap collider and the circle collider.

Is there a reason why you opted for the circle collider?

This topic was automatically closed after 27 hours. New replies are no longer allowed.

Privacy & Terms