How to generate mesh collider in a program ?

Hi!

I want to generate meshcollider in a program. Actually I want to create something like prismCollider. So here is a part of code:

Mesh CreatePrism(Vector3[] hits, int vertexCount)
	{
		MeshCollider mc = SelectionArea.GetComponent<MeshCollider>();
		
		Vector3[] vertices = new Vector3[vertexCount/**2*/];
		int numTriangles = (vertexCount-2);
		int[] triangles = new int[numTriangles*3];
				
	
		for(int i=0; i<vertexCount; i++)
			vertices _= hits*;*_

* int cnt = 0;*
* int k = 1;*
_ while (cnt != numTriangles3)_
_
{_
_
triangles[cnt] = 0; _
_
triangles[cnt+1] = k;_
_
triangles[cnt+2] = k+1;_
_
cnt+=3;_
_
k++;_
_
}*_

* Mesh m = new Mesh();*
* m.vertices = vertices;*
* m.SetTriangles(triangles, 0);*

* return m;*
* }*
And here is how I call it:
MeshCollider mc = SelectionArea.GetComponent();
mc.sharedMesh = CreatePrism(hitsPos, 4);
mc.enabled = true;
In the code above I am trying to create just a plane with 2 triangles. However I can’t figure out why my code doesn’t work. It shows something similar to thin box rotated and having some random coordinates.
I will appreciate if you could help as soon as possible.
P.S.
I am sorry if there is such theme elsewhere but I haven’t found none.
Update:
After I added MeshFilter + MeshRenderer to my object I see my plane, surrounded by bounding box I think(box colored with green):
![alt text][1]
_*[1]: http://i.imgur.com/s9iBpE8.png*_
And the plane begin to rotate, rising to the sky. What could do that ?
Update2:
Ok… A think I got it. The physics somehow rising it to the sky… If I set to MeshCollider IsTrigger option to true the plane stays on the ground. However, I still do not understand why is so big bounding box and what it means ?

I think you need to call yourmesh.RecalculateBounds();

So, okay… I have just figured out what went wrong. I just unchecked Convex in meshcollider and all became as it should be. =) However I am not sure why Convex have influence(I am not sure if it is a correct word) or react in such a way. I will put it as the answer to that question.