Unity3d Is there something like Mesh Collider for

2019-04-15 17:58发布

Im making simple 2D game, I designed the "way" the player going through in the game. If the player touches the wall the game is over, so I must detect collisions.

At first I created the walls from sprites, but then I realized there is no 2D collider that suit himself to the shape of the sprit(it was to difficult to create the collider manually from a lot of smaller polygon and circle colliders), so I made all the walls that builds the "way" 3D objects(.dae files with z=0.001), and added them the mash collider which suits himself to the 3D object. I changed my player to be 3D as well so the collisions types will match. It worked, but I'm sure the same game can work by much better performance with the same resources if all the game objects were 2D.

How can it be that there if a collider that suits himself to a 3D object but there is none for 2D? Maybe I miss something?

1条回答
▲ chillily
2楼-- · 2019-04-15 18:05

At my first attempt I didn't export the sprite correctly so the polygon collider didn't recognized the shape of my sprite.

I export the sprite as JPEG, when I export it as .png it worked like a charm, just added the Polygon Collider and it match to my sprite shape perfectly, thanks!

查看更多
登录 后发表回答