Exemplo n.º 1
0
    public static string[] LoadOnlyObj(string filepath, Vector3 targetV)
    {
        GameObject target = OBJLoader.LoadOBJFile(filepath);

        string[] emptyPosIDs = ObjLoadHelper.ShiftPosition(target, targetV);
        Object.Destroy(target);
        return(emptyPosIDs);
    }
Exemplo n.º 2
0
    public static string[] LoadObj(string[] filepaths, Vector3 targetV, bool isTest = true)
    {
        GameObject target = OBJLoader.LoadOBJFile(filepaths[0]);

        string[] emptyPosIDs = ObjLoadHelper.ShiftPosition(target, targetV);

        if (target.transform.childCount > 0)
        {
            Texture2D texture = TextureLoader.LoadTexture(filepaths[1]);
            foreach (Transform child in target.transform)
            {
                child.gameObject.AddComponent <MeshCollider> ();
                child.gameObject.GetComponent <Renderer> ().material             = new Material(Const.DIFFUSE_SHADER);
                child.gameObject.GetComponent <Renderer> ().material.mainTexture = texture;
            }
        }
        return(emptyPosIDs);
        //return target;
    }