Cammin / LDtkToUnity

Unity importer for the LDtk level editor
https://cammin.github.io/LDtkToUnity
MIT License
388 stars 39 forks source link

Collision is not working. #9

Closed sammysheardev closed 3 years ago

sammysheardev commented 3 years ago

I have no idea if this is me doing something wrong, but collision just straight up doesn't work. The player just falls through the map. I've tried manually adding the player prefab and using it as an entity and nothing has worked. I have a capsule collider 2d and a rigidbody 2d on my player, and as far as I can tell the tilemap collider was set up properly when it was generated.

sammysheardev commented 3 years ago

OK I don't know why I did this, but I completely forgot to add sprites to the int grid values, so the collision now works after fixing that.

Cammin commented 3 years ago

Glad you were able to get it figured out. Yup, The tile layers are simply for art (no collision), and the int grid values are used to define collision. So to define any shape desired (eg. block, slope), you'd make a sprite and define the physics shape of the sprite asset to use for the int grid tilemaps.