Making a game where player will have to draw a line to collide with ball and fall in destination point.
I made a script, that draws line with mouse on floor with mesh collider which gets baked at runtime.
The Mesh Collider is successfully generated along with line renderer, but the falling ball object ignores its collision.
Code for baking mesh of line renderer:
Mesh lineMesh = new Mesh();
lineMesh.name = "LineMesh(Clone)";
lineRenderer.BakeMesh(lineMesh, wallCamera, true);
meshCollider.sharedMesh = lineMesh;
Mesh collider is already there in the line renderer prefab which spawned at runtime when drawing.
In the above code, wallCamera is another camera in scene which helps to align the mesh collider to stand as a wall.
In above screenshot, the ball is going through.