TECHNOLOGY

MuJoCo ray queries: sensor visibility does not follow contact bitmasks

In this article
THE QUICK TAKE

Ray selection and physics-contact selection use different contracts; disabling a geom’s dynamic contact mask does not alone make it invisible to a ray query.

A noncolliding object can still be visible

A twin uses a ray query as a virtual range sensor. A decorative geom is removed from dynamic contact interactions, yet the sensor still reports its surface. The modeler assumes the collision-mask edit failed. Instead, the sensor and physics can be consulting different selection rules. Define which geometry the sensor is meant to observe independently from which geometry can produce contact constraints. One shared mesh asset does not require one shared eligibility policy.

Read the ray API rather than the contact rule

The ray reference describes nearest-surface intersection with group selection, static inclusion and body exclusion controls. These are inputs to the ray query itself. It also requires current kinematic quantities before querying. Do not infer ray selection from the bidirectional contype/conaffinity rule used for dynamic contact pairs. A contact-mask setting answers whether selected geoms can interact through that physics path, not whether a ray should include one of their surfaces.

Inspect the actual elimination path

The inspected ray implementation evaluates body exclusion, visibility-related transparency, static-body policy and the selected geom groups before testing surfaces. The dynamic contact-mask predicate is not the eligibility test in that path. Preserve material and visibility context when diagnosing a missing hit; changing transparency or group membership can affect a ray without changing the intended physics. Conversely, removing contact participation alone should not be assumed to remove the geom from the ray’s candidate population.

Propose independently controlled visibility cases

A proposed fixture should place a known surface along a declared ray, then vary contact participation and ray-group inclusion independently. Include a static geom and an explicitly excluded body in separate cases. Inspect hit identity and distance after updating required kinematics. Keep ray direction normalization and distance interpretation explicit. This fixture tests selection semantics, not optical realism or range noise, and no ray-performance measurement or hardware sensor experiment was performed here.

Accept the sensor’s own geometry inventory

Retain compiled geom names and groups, relevant visibility settings, static policy, body exclusion and the ray’s origin and direction. A miss should have an explicit outcome rather than reuse a previous hit identity. If an asset-loading optimization removes visual-only geometry, reinspect the sensor candidate set even when the dynamics comparison remains unchanged. The acceptance target is the intended sensor-query population and result, not merely a matching object count or a contact configuration that looks correct.

Keep ray sensing separate from physical contact

The Embree query guide explains another ray-interface distinction; software reproducibility supports preserving selection settings. Here the specific claim is that virtual sensing and contact filtering remain separately configured contracts. A ray hit does not establish a contact event, and a collision-free physics step does not imply the sensor has an unobstructed view. Real sensor behavior requires additional modeling and validation beyond geometric intersection.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles