google-deepmind / mujoco

Multi-Joint dynamics with Contact. A general purpose physics simulator.
https://mujoco.org
Apache License 2.0
8.17k stars 816 forks source link

Defining a Mesh as Floor for simulation #358

Closed hosseinfeiz closed 2 years ago

hosseinfeiz commented 2 years ago

Hi,

I'm a student and I'm trying to use MuJoCo for Correcting the poses estimated from videos.

I'm looking for some help with XML part of simulation. I want to use a mesh of the ring as the plane(the whole possible space of motion) to restrict the motion to inside the ring. What should I add to the ring mesh? Here is a model which explains my question:

minimal XML ```XML

Here is a video, illustrating my question:

https://user-images.githubusercontent.com/64847793/175398073-72f3cdaa-492c-41c9-be82-b16255fdb0ae.mp4

kevinzakka commented 2 years ago

I'm confused at what you are trying to do, could you be more specific?

hosseinfeiz commented 2 years ago

Hi, How can I add a mesh as a rigid body? I need the mesh to act as the floor for the humanoid that I am using. Can you watch the video that I sent? 1

yuvaltassa commented 2 years ago

If I'm understanding your question, the answer is: you cannot do that. Meshes collisions use the mesh's convex hull, not the actual mesh. So your options are:

  1. Decompose the mesh into convex parts using e.g. VHACD.
  2. Build this decomposition yourself from primitives like e.g. in the mug example.

Looking at your boxing ring mesh, I think option 2 is very easy to do, the whole thing can be well approximated by 5 boxes, no?