Ejemplo n.º 1
0
    public void CreateMesh()
    {
        // cleanup first
        for (int i = 0; i < m_clayRoot.childCount; ++i)
        {
            DestroyImmediate(m_clayRoot.GetChild(i).gameObject);
        }

        // create ClayMesh
        ClayMesh clayMesh = ClayMeshFactory();

        // assign ClayMesh
        ClayMeshContext cmc = Instantiate <ClayMeshContext>(m_prefab, m_clayRoot);

        cmc.gameObject.name = "Clay Mesh " + System.DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
        cmc.clayMesh        = clayMesh;

        // generate mesh based on ClayMesh
        clayMesh.GenerateMesh();

        Vertices  = clayMesh.Mesh.vertexCount;
        Triangles = clayMesh.Mesh.triangles.Length / 3;
    }
Ejemplo n.º 2
0
 protected virtual void Awake()
 {
     m_meshFilter      = GetComponent <MeshFilter>();
     m_meshCollider    = GetComponent <MeshCollider>();
     m_clayMeshContext = GetComponent <ClayMeshContext>();
 }
Ejemplo n.º 3
0
 void Awake()
 {
     _meshFilter = GetComponent <MeshFilter> ();
     _cmc        = GetComponent <ClayMeshContext>();
 }