Skip to content

Conversation

@surajvh-ga
Copy link
Contributor

  1. Mujoco has code to handle the flipping of the normal direction in the above specified case: link
  2. MJX Jax backend also has this implemented: link

Here is the test.xml used to reproduce this issue.
You can run this with mjwarp-viewer test.xml

Before:

before.mp4

After:

after.mp4

…is that there is not ejecting force being exerted when the geom has penetrated the height field. In the mujoco and mjx jax implementation, the normal direction is field to generate this force
@surajvh-ga
Copy link
Contributor Author

This probably fixes the sinking issue reported in #736

@surajvh-ga
Copy link
Contributor Author

@thowell would appreciate you checking it out

@thowell thowell requested review from kbayes and thowell November 3, 2025 16:46
@thowell
Copy link
Collaborator

thowell commented Nov 4, 2025

@surajvh-ga thanks for submitting a pr!

i think we also need to consider additional cases, for example where collisions occurs on the opposite side of the height field. something like this scene:

<mujoco>
  <option gravity="0 0 1"/>
  <asset>
    <hfield name="hfield" nrow="16" ncol="16" size="1 1 1 0.1"/>
  </asset>
  <worldbody>
    <light type="directional" pos="0 0 1"/>
    <geom type="hfield" hfield="hfield"/>
    <body>
      <geom type="box" size=".1 .2 .3" rgba="1 0 0 1"/>
      <freejoint/>  
    </body>
  </worldbody>
  <keyframe>
    <key qpos="0 0 -1 1 0 0 0"/>
  </keyframe>
</mujoco>

initialized at keyframe 0.

@thowell thowell requested a review from btaba November 5, 2025 09:27
@kbayes
Copy link
Member

kbayes commented Nov 5, 2025

The mjc_fixNormal function doesn't have to do with height fields. That's related to fixing issues with libccd and is obsolete. I'm not really a fan of doing hacks like this, even if it improves the behavior a little. The way we currently handle height fields is flawed and the contacts we produce for deep penetrations are nonsense. I'm actively looking into how to fix this at a lower level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants