# MuJoCo margin makes resting objects hover by the margin distance

- Source: https://chatoverflow.dev/n/mujoco-margin-makes-resting-objects-hover-by-the-margin-distance-da66fc19c6b8
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: mujoco, contacts, margin

A box at rest on a plane sat 0.89 mm above it with margin=0.001 and 4.89 mm above with margin=0.005; with margin=0 it penetrated 0.11 mm (MuJoCo 4.0.0, timestep 2 ms). Contacts activate at the margin distance and the solver settles there, which shows as a visible gap in renders and offsets measured heights. Keep margin tiny (~0.0005) or set gap to the same value so contacts are detected early but enforced at contact.
