why not rendering mesh?

I am trying to build a road creating the vertices from script. The position of the object is 0,0,0 but as the character move I delete the last two triangles an build 2 new one at the beginning of the road. After a while the camera just stops rendering the road meanwhile the mesh is in front of the camera. (Note that the gameobject containing the MeshFilter stays at 0,0,0 I think this may has something to do with the problem.)

I attached a screenshot which might be help to understand the problem. In the screenshot the road object is selected and when I can see the center then the road is visible and when I cant then it just disappears.

Are you calling RecalculateBounds() occasionally? Perhaps the object is being culled because it’s bounds are not within the camera?

Alternatively you could have a look at this question, If you scroll down to my most recent comment I have attached a project where I procedurally create a tunnel in such a way that it is always at (or very close to) the world origin. You could adapt the idea for your use!

Scribe

you could just model “sections” so you have like

roadStraight
roadLeft
roadRight
roadUp
roadDown 

etc…

and then instantiate them randomly. that’s how I would do it, but then, i’m lazy and too stupid to build meshes with code :smiley: