Notice: This question is long winded, and anyone wanting to help will need to dig through a formidable amount of code looking for an obscure glitch. If you are faint of heart, please turn away now.
I had asked a question that is more or less identical to this one a few months ago, but lacking a sufficiant answer and unable to find an answer myself after several months of on and off trying, I am here to ask for help again.
I am making infinite terrain generation, and have come across a problem. It is block and chunk based (think Minecraft), and it is supposed to make a mesh for each chunk by putting adding 2 triangles for every face of a block that is facing air. However, it does not do this correctly, and oftentimes renders blocks that are surrounded by other solid blocks. The only pattern I see in the rendering error are as follows:
- If the player shifts positively in the x-axis to prompt new chunks to be loaded, extra blocks seem to be loaded below the player with the quantity equal to how many chunks the player shifted.
- If the player shifts negatively in the x-axis, no blocks are rendered.
Any help would be appreciated.
I have used the following link as a guide to the scripts, reading through it may help you understand how my code works.
Guide
Below I have the links to the different files in the generation (in descending order of importance)
ChunkRenderer.cs
World.cs
terrainGen.cs
Chunk.cs
B.cs
BlockTypes.cs
DirtyType.cs
AirType.cs
PriorityQueue.cs
Also, the website of unity answers seems to have a long running feud with me, and as such I often am unable to perform certain actions in posts, such as replying to answers. Because of this, I may post answers to this question that are really just replies to their answers, so please refrain from having the mistaken notion that I am making tons of new answers because I don’t know how the site works or that I’m just an asshat.