示例#1
0
    void Start()
    {
        ColladaExporter export = new ColladaExporter("rock_5.dae", true);

        export.AddGeometry("rock_5", rock_5);
        export.AddGeometryToScene("rock_5", "Rock");
        export.Save();
    }
示例#2
0
    void SaveToFile()
    {
        ColladaExporter export = new ColladaExporter(FileName + ".dae", true);

        for (int i = 0; i < SaveGameObject.transform.childCount; i++)
        {
            var meshFilter = SaveGameObject.transform.GetChild(i).GetComponent <MeshFilter>();
            if (meshFilter.gameObject.activeSelf && meshFilter != null)
            {
                export.AddGeometry(meshFilter.transform.name, meshFilter.mesh);
                Vector3 position = meshFilter.transform.position;
                position.x = -1 * position.x;
                var matrix = Matrix4x4.TRS(position, meshFilter.transform.rotation, Vector3.one);
                export.AddGeometryToScene(meshFilter.transform.name, meshFilter.transform.name, matrix);
            }
        }

        export.Save();
    }