예제 #1
0
        //Draws a line given a list of vector 3
        public GameObject dropLine(List <Vector3> polyline, float witdh, float height, Material material, GOUVMappingStyle uvMappingStyle, bool curved = false)
        {
            GameObject line = new GameObject("Polyline");

            MeshFilter   filter   = line.AddComponent <MeshFilter>();
            MeshRenderer renderer = line.AddComponent <MeshRenderer>();

            GOLineMesh lineMesh = new GOLineMesh(polyline, curved);

            lineMesh.width = witdh;
            lineMesh.load(line);

            GOMesh goMesh = lineMesh.CreatePremesh();

            goMesh.uvMappingStyle = uvMappingStyle;

            if (height > 0)
            {
                goMesh = SimpleExtruder.SliceExtrudePremesh(goMesh, height, 4f, 4f, 10f);
            }

            filter.sharedMesh = goMesh.ToMesh();
            renderer.material = material;

            line.AddComponent <MeshCollider> ();

            return(line);
        }
예제 #2
0
        public GameObject CreateRoofFromPreloaded(GOFeature feature, GOMesh premesh, GameObject parent)
        {
            GameObject roof   = GameObject.Instantiate(feature.goTile.featurePrototype, parent.transform);
            MeshFilter filter = roof.GetComponent <MeshFilter>();

            filter.mesh = premesh.ToMesh();
            return(roof);
        }
        public GameObject CreateRoofFromPreloaded(GOMesh premesh)
        {
            GameObject roof   = new GameObject();
            MeshFilter filter = roof.AddComponent <MeshFilter>();

            roof.AddComponent(typeof(MeshRenderer));
            filter.mesh = premesh.ToMesh();
            return(roof);
        }
예제 #4
0
        public Mesh groundMesh()
        {
            updateVertices();
            GOMesh goMesh = flatTerrainMesh();

            if (goMesh == null)
            {
                return(null);
            }

            return(goMesh.ToMesh());
        }