Skip to main content
Renders contact points as small spheres using InstancedMesh for performance. Useful for debugging contact behavior.

Usage

<MujocoCanvas config={config}>
  <ContactMarkers />
</MujocoCanvas>

Customized

<ContactMarkers
  maxContacts={50}
  radius={0.01}
  color="#ff4444"
  visible={showContacts}
/>

Props

maxContacts
number
default:"100"
Maximum number of contact points to render. Limits are important to avoid WASM out-of-memory when reading contact data.
radius
number
default:"0.005"
Sphere radius for each contact marker.
color
string
default:"#4f46e5"
Color of the contact markers.
visible
boolean
default:"true"
Toggle visibility. Useful for a debug panel toggle.

Notes

  • Contact data is read from data.contact every frame
  • Access is wrapped in try/catch since contact reads can fail if ncon is large
  • The component always checks data.ncon before iterating contacts
  • Uses InstancedMesh for efficient rendering of many small spheres