URDF-Importer icon indicating copy to clipboard operation
URDF-Importer copied to clipboard

Unable to import URDF files with OBJ meshes at runtime.

Open 707346129 opened this issue 3 years ago • 5 comments

I can import URDF files with OBJ meshes through Unity GUI, but when I tried to import them at runtime with the UrdfRobotExtensions.CreateRuntime() method, I would meet errors like "Unable to create mesh collider for the mesh: package://textured_objs/original-7.obj". I checked the code at URDF-Importer-0.5.0/com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs:93 and find that it probably only supports STL meshes. Is it possible to import URDF files with OBJ meshes at runtime?

707346129 avatar Sep 07 '21 10:09 707346129

[Internal Ticket#: AIRO-1212]

hyounesy avatar Sep 07 '21 16:09 hyounesy

Hi @707346129, thanks for letting us know. Just wish to double-check whether you are trying to import URDF files in Unity Editor play mode or in a standalone executable? If it is in Unity Editor play mode, you could use the UrdfRobotExtensions.Create() method to import, which supports OBJ meshes. For the standalone executable, currently, it doesn't support importing OBJ meshes, but we could add this feature. Please let us know.

peifeng-unity avatar Sep 07 '21 18:09 peifeng-unity

I can import URDF files with OBJ meshes through Unity GUI, but when I tried to import them at runtime with the UrdfRobotExtensions.CreateRuntime() method, I would meet errors like "Unable to create mesh collider for the mesh: package://textured_objs/original-7.obj". I checked the code at URDF-Importer-0.5.0/com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs:93 and find that it probably only supports STL meshes. Is it possible to import URDF files with OBJ meshes at runtime?

I've solved this problem by modifying the "URDF-Importer-0.5.0/com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs". You can replace the line "Debug.LogError("Unable to create mesh collider for the mesh: " + mesh.filename);" with "meshObject = MeshImporter.Load(meshFilePath);" and add a line "using UnityMeshImporter;" on the top of this script. Then your code will run correctly. By the way, "MeshImporter.Load(meshFilePath);" is a function to load mesh files defined in "URDF-Importer-0.5.0/com.unity.robotics.urdf-importer/Runtime/UnityMeshImporter/MeshImporter.cs". Hope this can help you~

CXY-Likescoding avatar Oct 11 '21 07:10 CXY-Likescoding

This issue has been marked stale because it has been open for 14 days with no activity. Please remove the stale label or comment on this issue, or the issue will be automatically closed in the next 14 days.

github-actions[bot] avatar Feb 03 '22 17:02 github-actions[bot]

This issue has been marked stale for 14 days and will now be closed. If this issue is still valid, please ping a maintainer.

github-actions[bot] avatar Feb 18 '22 17:02 github-actions[bot]