Definitive Fix When Your Character Gets STUCK In Ground Tiles (Unity Basics)!

preview_player
Показать описание

First tutorial video about a common issue with 2D collisions in Unity. Hopefully this gives a good solution when a box collider 2D get stuck in ground tiles as opposed to using a circle collider which many online sources recommend.

Background Music:
Spilled Water on Notes - chillin_wolf (Soundcloud: @chillin_wolf)

Licensed under Creative Commons: By Attribution-ShareAlike 3.0
Рекомендации по теме
Комментарии
Автор

This is one way to solve that, thanks for sharing. There's another way where you can still use circle or capsule colliders for your character if you like:
For your tile sprites, open the Sprite Editor and customize the physics shape of your sprite (by clicking the "Sprite Editor" dropdown in the top left corner inside of the Sprite Editor. Doing that for the surface tiles (the ones, that the character walks on, shbould be enough in most cases. AFTERWARDS add the tilemap collider component.
This way, not only those edgy gaps at the corners between tiles disappear int the tilemap collider, you can also define the size of the collider for your tiles precisely (on pixel level), which comes handy when the graphics are more like grass or something else not so obvious defined like your example in the video.

ewaldschulte
Автор

Bro! This is EXACTLY what I've been looking for! You just saved me SOO much frustration!!! Thank you so much!
EDIT: I'm having the same issue as some others where my character gets stuck in the floor...
EDIT2: Fixed it by changing the composite collider from outline to polygon.

LaSandWitch
Автор

Who knew such a silly problem had the most simple solution, I was already planning on creating an entire system to generate meshes. Thank you very much!

alTemp
Автор

Hours spent on forums to solve is problem, and you did it in a 5 minute video. Brilliant!

mikeokismall
Автор

Great tutorial, well explained and not too long, thanks and keep it up!

GilDev
Автор

When I found out my character was getting caught on stuff, including the edges, I was thinking, "What the hell is going on?"
I tried your method.

Worked *perfectly.*

CoolModderJaydonX
Автор

Thanks man! I was stressed about this problem and I knew that changing the character's collider was the wrong way! thanks for existing

saloverheaven
Автор

It seems like you stopped making videos a long time ago, your tutorial was very useful, tomorrow is the end of the GMTK game jam and you just saved my project. If you see this, merci mreuf tu gères ;)

louis_plaire
Автор

THANK YOU SO MUCH! I was getting frustrated that it didn't work but this was such an easy fix!

elliottgarneau
Автор

Can't help but comment on such a helpful video, every forum just didn't help at all.

burningtime
Автор

This bug has been plaguing me for years, thank god i found this video

havickk
Автор

As a game dev rookie, this saved my ass! Thank you!

SavageLookDotCom
Автор

Holy crap YESS!! And you can use Effector component as well if you mark "Used by effector" in the Composite.

eriknastesjo
Автор

Le petit accent Français qui ma donné le sourire pdt toute la vidéo, merci à toi btw ;).

BRtn-nnnr
Автор

I had to take a different solution for mine and couldn't rely on the composite collider method with a tilemap because I had to use multiple game objects with box colliders that could both be accessed and used as a ground layer in my 2D platformer object.
But I managed to get around this problem by creating an edge collider for my player to go along with my box collider. Creating lil slopped edges that aren't even noticeable when passing by this bug :)

SoulReaperx
Автор

Thank you for helping me save my time and my nerve cells.

markantony
Автор

thank you, i was worried f i coldn't solve my problem. your solution works for me, great video.

leonardo_ferreira
Автор

If you did this and still have the issue, just disable the TileMap collider and renable it and you will have it fixed. I'm glad that's the only very simple thing i have to do and not do a complicated thing to fix.

tPlayerioT
Автор

I know that this video is pretty old, but thank you so much for this useful information! I've been trying to fix this issue for a while now with no result. thanks for clearing this up :)

jedijames
Автор

Thank you so much man. Great tutorial. i was having this problem for a few days now. Glad I found this tutorial.

crabjuice