mesh collider automatically changing transform code example
Example: how to set a custom mesh as the mesh for a collider unity
All you have to do is go to "add component", "physics", and "mesh collider".
It will create a collider in the exact shape of the mesh.