Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Google deepmind Mujoco MJWarp Collision Convex

From Leeroopedia
Revision as of 12:45, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Google_deepmind_Mujoco_MJWarp_Collision_Convex.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Physics_Simulation, GPU_Computing, NVIDIA_Warp
Last Updated 2026-02-15 04:00 GMT

Overview

MJWarp Collision Convex implements narrowphase collision detection for convex geometry pairs using GJK/EPA and CCD algorithms on the GPU.

Description

This module handles convex-convex collision detection including height field collisions, mesh collisions, and general convex shape pairs. It builds GPU kernels that use the GJK distance algorithm, EPA penetration depth computation, and continuous collision detection (CCD) for generating contact points. The module includes specialized height field filtering logic and supports multi-contact generation for convex pairs through the multicontact function from the GJK module.

Usage

Invoked by the collision driver when geometry pairs are classified as CONVEX collision type in the MJ_COLLISION_TABLE. This handles pairs such as hfield-sphere, ellipsoid-ellipsoid, cylinder-box, mesh-mesh, and others.

Code Reference

Source Location

Key Functions

# Primary entry point for convex narrowphase
def convex_narrowphase(m: Model, d: Data, ctx: CollisionContext,
                       collision_table: list[tuple[GeomType, GeomType]])

# Height field collision filter
def _hfield_filter(geom_type, geom_dataid, geom_size, ..., worldid, g1, g2)
    -> Tuple[bool, float, float, float, float, float, float]

# Kernel builders for CCD collision
def ccd_hfield_kernel_builder(...)
def ccd_kernel_builder(...)

Import

from mujoco.mjx.third_party.mujoco_warp._src.collision_convex import convex_narrowphase

I/O Contract

Inputs

Name Type Required Description
m Model Yes Warp model with geometry, mesh, and height field data
d Data Yes Warp simulation data with current transforms
ctx CollisionContext Yes Collision context with broadphase pair lists and contact arrays
collision_table list[tuple[GeomType, GeomType]] Yes List of geometry type pairs to process as convex collisions

Outputs

Name Type Description
d.contact Contact Updated contact data with positions, normals, and depths
d.nacon wp.array Updated active contact count

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment