public void test()
    {
        Mesh            holderMesh = new Mesh();
        FastObjImporter newMesh    = new FastObjImporter();

        holderMesh = newMesh.ImportFile("C:/Users/cvpa2/Desktop/ng/output.obj");

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

        filter.mesh = holderMesh;
    }
    public static void setMesh(GameObject objHolder)
    {
        //load model
        //ObjImporter newMesh = new ObjImporter();
        FastObjImporter newMesh    = new FastObjImporter();
        Mesh            holderMesh = newMesh.ImportFile(MODEL_SAVE_PATH);

        //set mesh filter object to loaded model
        MeshFilter filter = objHolder.GetComponent <MeshFilter>();

        filter.mesh = holderMesh;
        print("Done loading object onto mesh");
    }
예제 #3
0
    void GenerateGameObjects()
    {
        ModelManager    ModelImporter = new ModelManager();
        FastObjImporter importer      = new FastObjImporter();

        GameObject ObjectHolder = GameObject.FindGameObjectWithTag("ObjectHolder");

        _HullGameObjects = new GameObject[_Hull.Count];
        for (int i = 0; i < _Hull.Count; i++)
        {
            GameObject HullObject = new GameObject();
            HullObject.name = _Hull[i].Name;
            HullObject.AddComponent <MeshFilter>().mesh = importer.ImportFile(_Hull[i].ModelPath);
            //HullObject.AddComponent<MeshFilter>().mesh = ModelImporter.loadMeshFromFile(_Hull[i].ModelPath);
            HullObject.AddComponent <MeshRenderer>().material = new Material(_Mat);
            HullObject.transform.position = Vector3.zero;
            HullObject.transform.SetParent(ObjectHolder.transform);
            _HullGameObjects[i] = HullObject;
        }
        ObjectHolder.SetActive(false);
    }
예제 #4
0
    void UpdateMesh()
    {
        FastObjImporter importer = new FastObjImporter();

        mesh.mesh = importer.ImportFile(GameDataManager.instance.ReturnHullWithID(ID).ModelPath);
    }