From 2e8f71be4294a93193d72224d5e400866c3a6761 Mon Sep 17 00:00:00 2001 From: Kapim Date: Wed, 8 Dec 2021 12:38:27 +0100 Subject: [PATCH] =?UTF-8?q?Fixed:=20*=20STL=20meshes=20we=20rotated=20by?= =?UTF-8?q?=20180=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs b/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs index a62ea1494..79249c053 100644 --- a/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs +++ b/arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs @@ -65,6 +65,10 @@ private void ImportMesh(string path, string aoId) { // Supports: FBX, OBJ, GLTF2, STL, PLY, 3MF AssetLoaderOptions assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions(); AssetLoader.LoadModelFromFile(path, null, delegate (AssetLoaderContext assetLoaderContext) { + if (Path.GetExtension(path).ToLower() == ".stl") { + assetLoaderContext.RootGameObject.transform.Rotate(0f, 180f, 0f); + } + OnMeshImported?.Invoke(this, new ImportedMeshEventArgs(assetLoaderContext.WrapperGameObject, aoId)); }, null, assetLoaderOptions: assetLoaderOptions, onError: OnModelLoadError, wrapperGameObject: loadedObject); }