Are flexible objects supported now in Unity Plugin? #3221
Replies: 2 comments 11 replies
-
|
Hello! Glad you are interested in deformable objects in Unity! I made the PR for the preliminary support. Flexes were supported as far as the example scenes went that were shipped with Mujoco at that time point (if I remember correctly, it has been a while #2325). Rendering of the flex meshes was incomplete, I think I had problems with the normals, but I had some support for it! There are some instructions on how to try it. It was experimental, however it might work for your needs, or you could get it working with a bit of development! Your best option is to check out the PR version of the plugin (look into how to add a specific branch of a git package to your Unity project, but I can help if you get stuck on that). Importantly, add the mujoco and plugins that correspond to the same version (I think it was 3.2.5)! Let me know if you have issues, I might be able to troubleshoot. However, I won't be able to active development on it until end of May (feel free to ping me here then!) As far as VR/XR goes It is definitely possible!. With oculus/meta link it is quite straightforward, no different than doing a VR scene in Unity + doing a MuJoCo Scene. To interact physically, track the end effectors with MjMocapBodies, and use MjWeld constraints on collider bodies to track the MocapBodies. For standalone builds, you can use the android builds from @joanllobera, see #3195 One last thing, as far as alternate options instead of flex bodies, you can try composite bodies. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks, that helped!
Please let me know if you have any idea, how to make them collide. And if you have an idea how to decrease the high delays in the VR. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Intro
Hi!
I am a master's student at FAU Erlangen-Nürnberg, I use MuJoCo for my research on deformable object dynamics in combination with VR.
My setup
My question
I am attempting to import .xml files from the mujoco-3.6.0/model/flex directory (e.g. /softbox.xml) using Assets > Import MuJoCo Scene in Unity. Since the flex plugins were merged into version 3.6.0 via a pull request (or even earlier), I expected these models to load and function correctly. However, I am instead encountering the attached error messages.
I have thoroughly searched for existing discussions on this issue, but the available resources appear to be outdated or refer to significantly older versions (e.g. #2008 ).
I would appreciate clarification on the following points:
The error messages indicate that flex is not yet supported. Could you confirm whether this is indeed the case, or if there might be an issue with my configuration? I am particularly confused by the presence of elasticity.dll if the Unity importer cannot process flex .xml files.
If flex is not currently supported, are there alternative approaches for implementing deformable objects in Unity using MuJoCo?
Has anyone successfully combined the MuJoCo plugin with XR Interaction (e.g., Meta Quest 3) in Unity? Specifically, is it possible to interact with MuJoCo objects in this setup?
Thank you very much for your time and assistance. I look forward to your response.
Imported MJCF loaded, saved to C:/Users/XXX~1/AppData/Local/Temp/DefaultCompany/MuJoCo\softbox863.xml
UnityEngine.Debug:Log (object)
Mujoco.MjImporterWithAssets:ImportFile (string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:56)
Mujoco.MjImporterEditorWindow:Apply () (at ./Packages/unity/Editor/Importer/MjImporterEditorWindow.cs:28)
Meshes locations: source = C:\Users\XXX\MuJoCo3.6\mujoco-3.6.0\mujoco-3.6.0\model\flex\asset/, target = C:/Users/XXX/MuJoCo3.6/Assets\Local\MjImports\softbox863\Resources
UnityEngine.Debug:Log (object)
Mujoco.MjImporterWithAssets:ConfigureMeshPath (string,string,System.Xml.XmlDocument) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:119)
Mujoco.MjImporterWithAssets:ImportString (string,string,string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:72)
Mujoco.MjImporterWithAssets:ImportFile (string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:60)
Mujoco.MjImporterEditorWindow:Apply () (at ./Packages/unity/Editor/Importer/MjImporterEditorWindow.cs:28)
The importer does not yet support tags .
UnityEngine.Debug:Log (object)
Mujoco.MjcfImporter:ParseBodyChild (System.Xml.XmlElement,UnityEngine.GameObject) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:293)
Mujoco.MjcfImporter:ParseBodyChildren (UnityEngine.GameObject,System.Xml.XmlElement) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:237)
Mujoco.MjcfImporter:ParseRoot (UnityEngine.GameObject,System.Xml.XmlElement) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:147)
Mujoco.MjImporterWithAssets:ParseRoot (UnityEngine.GameObject,System.Xml.XmlElement) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:91)
Mujoco.MjcfImporter:ImportXml (System.Xml.XmlDocument,string) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:100)
Mujoco.MjImporterWithAssets:ImportString (string,string,string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:75)
Mujoco.MjImporterWithAssets:ImportFile (string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:60)
Mujoco.MjImporterEditorWindow:Apply () (at ./Packages/unity/Editor/Importer/MjImporterEditorWindow.cs:28)
The importer does not yet support tags .
UnityEngine.Debug:Log (object)
Mujoco.MjcfImporter:ParseBodyChild (System.Xml.XmlElement,UnityEngine.GameObject) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:293)
Mujoco.MjcfImporter:ParseBodyChildren (UnityEngine.GameObject,System.Xml.XmlElement) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:237)
Mujoco.MjcfImporter:ParseRoot (UnityEngine.GameObject,System.Xml.XmlElement) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:147)
Mujoco.MjImporterWithAssets:ParseRoot (UnityEngine.GameObject,System.Xml.XmlElement) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:91)
Mujoco.MjcfImporter:ImportXml (System.Xml.XmlDocument,string) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:100)
Mujoco.MjImporterWithAssets:ImportString (string,string,string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:75)
Mujoco.MjImporterWithAssets:ImportFile (string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:60)
Mujoco.MjImporterEditorWindow:Apply () (at ./Packages/unity/Editor/Importer/MjImporterEditorWindow.cs:28)
The importer does not yet support equality .
UnityEngine.Debug:Log (object)
Mujoco.MjcfImporter:ParseEqualityType (System.Xml.XmlElement) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:315)
Mujoco.MjcfImporter:ParseRoot (UnityEngine.GameObject,System.Xml.XmlElement) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:186)
Mujoco.MjImporterWithAssets:ParseRoot (UnityEngine.GameObject,System.Xml.XmlElement) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:91)
Mujoco.MjcfImporter:ImportXml (System.Xml.XmlDocument,string) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:100)
Mujoco.MjImporterWithAssets:ImportString (string,string,string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:75)
Mujoco.MjImporterWithAssets:ImportFile (string) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:60)
Mujoco.MjImporterEditorWindow:Apply () (at ./Packages/unity/Editor/Importer/MjImporterEditorWindow.cs:28)
NullReferenceException: Object reference not set to an instance of an object
Mujoco.MjcfImporter.CreateGameObjectWithUniqueName (UnityEngine.GameObject parentObject, System.Xml.XmlElement parentNode, System.Type componentType) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:123)
Mujoco.MjcfImporter.ParseRoot (UnityEngine.GameObject rootObject, System.Xml.XmlElement mujocoNode) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:188)
Mujoco.MjImporterWithAssets.ParseRoot (UnityEngine.GameObject parentObject, System.Xml.XmlElement parentNode) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:91)
Mujoco.MjcfImporter.ImportXml (System.Xml.XmlDocument mjcfXml, System.String name) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:100)
UnityEngine.Debug:LogException(Exception)
Mujoco.MjcfImporter:ImportXml(XmlDocument, String) (at ./Packages/unity/Runtime/Importer/MjcfImporter.cs:104)
Mujoco.MjImporterWithAssets:ImportString(String, String, String) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:75)
Mujoco.MjImporterWithAssets:ImportFile(String) (at ./Packages/unity/Editor/Importer/MjImporterWithAssets.cs:60)
Mujoco.MjImporterEditorWindow:Apply() (at ./Packages/unity/Editor/Importer/MjImporterEditorWindow.cs:28)
Minimal model and/or code that explain my question
Confirmations
Beta Was this translation helpful? Give feedback.
All reactions