Skip to content

[Feature] Support for collision mesh authoring inside Unreal #47

@SiegeLordEx

Description

@SiegeLordEx

Summary

Allow using collections of simple collision shapes (as defined in the static mesh editor) for collision.

What problem does this solve?

Simplified collision often makes simulation more stable. Unreal has decent support for authoring the simple collisions by composing them from shapes. This feature would let MuJoCo use that collision, rather than trying to do convex decomposition on the mesh itself.

Proposed behaviour

In my prototype, I added a new toggle in MjQuickConvert to use the simple collision mesh, as well as a density modifier (I haven't gave it much thought to have a per-shape density just yet, or perhaps using the complex mesh just for the intertia computations, but keeping the simple collision simply for the collision):

Image

Then I added a few simple collision meshes to a complex static mesh that was not handled well by the convex decomposition:

Image

The compiled XML contained this object definition:

    <body name="SM_Mug_142_MjBody" pos="17.6752 -8.03431 0.832553" quat="0.754406 0.111619 -0.133022 -0.633023">
      <joint name="SM_Mug_142FreeJoint" type="free"/>
      <geom name="Geom_0_visual_1" type="mesh" contype="0" conaffinity="0" group="2" mesh="SM_Mug_01"/>
      <geom name="Geom_0_box_0_1" size="0.0331591 0.0334117 0.0523398" pos="-2.14577e-08 0.00281814 0.0523399" type="box" group="3" friction="1 1 1" solref="0.02 0.9" solimp="0.9 1 0.001" density="100"/>
      <geom name="Geom_0_box_1" size="0.00540711 0.01582 0.00428518" pos="-2.14577e-08 0.0531776 0.0455254" quat="0.931078 0.364821 0 0" type="box" group="3" friction="1 1 1" solref="0.02 0.9" solimp="0.9 1 0.001" density="100"/>
      <geom name="Geom_0_box_2" size="0.00540712 0.01582 0.00428517" pos="-2e-08 0.0643512 0.071028" quat="0.809304 -0.587391 0 0" type="box" group="3" friction="1 1 1" solref="0.02 0.9" solimp="0.9 1 0.001" density="100"/>
      <geom name="Geom_0_box_3" size="0.00540712 0.01582 0.00428517" pos="-2e-08 0.0433983 0.0819769" quat="0.999998 -0.00183656 0 0" type="box" group="3" friction="1 1 1" solref="0.02 0.9" solimp="0.9 1 0.001" density="100"/>
      <geom name="Geom_0_capsule_0" size="0.0423401 0.00810191" pos="-2.14577e-08 0.00149977 0.0523399" quat="6.08398e-09 1 0 0" type="capsule" group="3" friction="1 1 1" solref="0.02 0.9" solimp="0.9 1 0.001" density="100"/>
    </body>

API sketch (optional)

In my prototype, the code changes are primarily in the MjQuickConvert component, we just introspect the static mesh and grab its simple collision meshes, and then make sure the generated spec reflects them.

Alternatives considered (optional)

No response

How important is this to you?

Blocks my project

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions