I have been having an issue in making floating islands. For this i have created an array filled with the position data for both the top and bottom half of the island. Everything works fine when i only have the top half of the triangles implimented, but when i add the bottom half of the triangles become triangles that are shifted to the top half of the island.
To be more precise, the traingle index data seems to change while writing it to mesh.triangles.
This happens after mesh.triangles = triangles in the following code
mesh.Clear(); transform.position = new Vector3(-width/2,0 * scale,-height/2 * scale); positionsAll = new Vector3[2 * width * height]; setupHeightMap(); int triangles = getTriangles(); mesh.vertices = positionsAll; mesh.triangles = triangles; mesh.RecalculateNormals();
An example watch can be seen here, witth the first four showing the change in index, and the final four showing how the point is the same point but on the above surface.
triangles 30785 System.Int32 triangles 96322 System.Int32 mesh.triangles 30785 System.Int32 mesh.triangles 30786 System.Int32 mesh.vertices[triangles] "(65.0, 0.0, 120.0)" UnityEngine.Vector3 mesh.vertices[triangles] "(66.0, -0.2, 120.0)" UnityEngine.Vector3 mesh.vertices[mesh.triangles] "(65.0, 0.0, 120.0)" UnityEngine.Vector3 mesh.vertices[mesh.triangles] "(66.0, 0.2, 120.0)" UnityEngine.Vector3
This watch data was generated in an instance where all triangles that had positive values were not instanciated, but the same problem hapens if all Triangles are instanciated.
If anyone can tell me why this happens and/or how i can fix this problem that would be extremly helpful. thank you!