Skip to content

Avoid phantom contacts on unfilled variant mesh slots when num_envs=1 - #1330

Closed
M-Colley wants to merge 1 commit into
mujocolab:mainfrom
M-Colley:fix/variants-single-world-missing-mesh
Closed

M-Colley wants to merge 1 commit into
mujocolab:mainfrom
M-Colley:fix/variants-single-world-missing-mesh

Conversation

@M-Colley

Copy link
Copy Markdown
Contributor

When num_envs == 1 and a VariantEntityCfg leaves mesh geom slots unfilled (geom_dataid == -1) in that world, MuJoCo Warp 4.0.1 compiles out its _mesh_missing broadphase guard because wp_model.geom_dataid.shape[0] == 1, causing unfilled slots to collide at the origin as phantom geoms. This PR pads a duplicate second row onto wp_model.geom_dataid only in that single-world unfilled-slot case so _mesh_missing stays active in Warp kernels while slicing the TorchArray wrapper back to [:nworld] so PyTorch and viewer callers continue to observe shape (1, ngeom).

Fixes #1231

MuJoCo Warp compiles out its missing-mesh broadphase guard when geom_dataid has a single world row, causing unfilled mesh slots (dataid == -1) to collide at the origin when num_envs == 1. Pad a duplicate row onto wp_model.geom_dataid in that case while slicing TorchArray back to nworld so PyTorch and viewer consumers still see shape (1, ngeom).

Related to mujocolab#1231
@kevinzakka kevinzakka closed this Nov 14, 2026
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.

2 participants