1

I've made a mesh from an SVG in Blender and converted it to a mesh. I then put it into Unity, to put a collider on it, the mesh does not collide with anything, even with convex ticked.

Here is my collider:

Collider

And here is my mesh in Blender (blue is the outside of the mesh):

Mesh in blender

What the convex collider looks like:

Convex collider

Can someone tell me why the collider is not working? Cheers!

Jerry
  • 101
  • 1
  • 10
  • Did you have `Rigidbody` on the game object? And make sure your collider setting meet the `Collision action matrix` section in https://docs.unity3d.com/Manual/CollidersOverview.html – Willard Peng Jan 09 '23 at 02:43
  • I have a rigidbody2D component on my player but not on my mesh gameObjects – Jerry Jan 09 '23 at 06:36

2 Answers2

2

The MeshCollider is implemented in the 3D Physics engine and therefore incompatible with the 2D Physics engine. They simply don't interact.

What you probably want to use instead is the PolygonCollider2D

Voidsay
  • 1,462
  • 2
  • 3
  • 15
  • Thank you, the polygon collider needed a script that I found on the unity answers, here is the link: https://answers.unity.com/questions/1484280/generate-2d-polygon-collider-from-3d-mesh.html – Jerry Jan 10 '23 at 01:01
0

When working with Colliders and 2D, make sure you have the following:

  • RigidBody2D
  • Collider2D

In addition a Mesh Collider is a 3D implementation. If you want the 2D equivalent of a Mesh Collider in 2D, use a Polygon Collider 2D instead.

CorrieJanse
  • 2,374
  • 1
  • 6
  • 23
  • This is not what I am looking for. The game is 2D yes, I know that you need rigidbody2D. But my mesh collider isn't working – Jerry Jan 09 '23 at 06:35
  • Mesh collider is a 3D implementation so it won't work. Remove it and add `Polygon Collider 2D` which is a mesh collider but for 2D – CorrieJanse Jan 09 '23 at 22:49