-1
런타임시 메쉬를 stl/obj/fbx 형식으로 내보내고 Android 폰의 로컬 파일에 저장하는 방법을 찾고 있습니다.런타임에 메쉬를 stl/obj/fbx로 변환
어떻게하면됩니까? 플러그인 (유료/유료)을 사용하고 싶습니다.
런타임시 메쉬를 stl/obj/fbx 형식으로 내보내고 Android 폰의 로컬 파일에 저장하는 방법을 찾고 있습니다.런타임에 메쉬를 stl/obj/fbx로 변환
어떻게하면됩니까? 플러그인 (유료/유료)을 사용하고 싶습니다.
이것은 각 형식 (stl/obj/fbx)에 대한 사양을 읽고 자신을 만들기 위해 이해해야하기 때문에 실제로 복잡합니다. 운 좋게도 이미 Unity 메쉬를 stl, obj 및 fbx로 내보내는 데 사용할 수있는 많은 플러그인이 있습니다.
FBX은 :
UnityFBXExporter는 유니티 런타임 동안 FBX 메쉬 수출하는 데 사용됩니다. OBJ
public GameObject objMeshToExport;
void Start()
{
string path = Path.Combine(Application.persistentDataPath, "data");
path = Path.Combine(path, "carmodel"+ ".fbx");
//Create Directory if it does not exist
if (!Directory.Exists(Path.GetDirectoryName(path)))
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
}
FBXExporter.ExportGameObjToFBX(objMeshToExport, path, true, true);
}
: OBJ를 들어, ObjExporter
를 사용
.
public GameObject objMeshToExport;
void Start()
{
string path = Path.Combine(Application.persistentDataPath, "data");
path = Path.Combine(path, "carmodel" + ".obj");
//Create Directory if it does not exist
if (!Directory.Exists(Path.GetDirectoryName(path)))
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
}
MeshFilter meshFilter = objMeshToExport.GetComponent<MeshFilter>();
ObjExporter.MeshToFile(meshFilter, path);
}
STL는 :
당신은 STL 형식에 대한 pb_Stl 플러그인을 사용할 수 있습니다.
public GameObject objMeshToExport;
void Start()
{
string path = Path.Combine(Application.persistentDataPath, "data");
path = Path.Combine(path, "carmodel" + ".stl");
Mesh mesh = objMeshToExport.GetComponent<MeshFilter>().mesh;
//Create Directory if it does not exist
if (!Directory.Exists(Path.GetDirectoryName(path)))
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
}
pb_Stl.WriteFile(path, mesh, FileType.Ascii);
//OR
pb_Stl_Exporter.Export(path, new GameObject[] { objMeshToExport }, FileType.Ascii);
}
감사합니다. 나는 Github에서 플러그인을 찾는 것을 생각 해보지 않았다. 나는 오늘이 모든 플러그인을 나중에 시험해 보겠다. –
사용자는 자신의 휴대 전화 케이스를 디자인 한 다음 3D 인쇄가 가능한 STL/OBJ 형식의 3D 지오메트리 파일을 생성 할 수있는 학교용 Android 앱을 개발하고 싶습니다. (죄송합니다. 질문에 명확히하지 않아서 죄송합니다.) 그 외 이유는 Android 앱에서 런타임에 gameobjects/meshes를 stl/obj/fbx 파일로 내보내는 플러그인이 필요하기 때문입니다. void Start() (제안한 코드)에서 pb_Stl 및 UnityFBXExporter를 모두 시도했습니다. 하지만 내 앱을 켜면 내부 저장소가 열립니다. 나는 아무 것도 창조되지 않았다는 것을 것을을 발견했다. –
void Start() 대신 다른 함수에서 이러한 내보내기 코드를 구현할 수 있는지 알고 싶습니다. 왜냐하면 내가 원하는 것은 응용 프로그램의 시작 대신 특정 버튼을 클릭 할 때만 stl 파일을 생성하는 것입니다. –