In the simulation data, we have a array of mjContact. I got couple questions, 1. If I iterate through the array of contacts, how do I know if that contact is active? a. I checked the contact array in sim data during the simulation(which should be detected collision according to comments), the number ncon does look like the same as number of elements in array mjData.contacts. And I got all 0 in dist, geom1, and geom2 in a lot of the contacts. What does it mean they're all 0? Geom 0 contact Geom 0 itself? Code: ===============Detected Contact: 2=================== Distances: -0.0025427378168232095 efc_address: 0 contact pos: [ 0.14256377 0.15715391 -0.00127137] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 13 Distances: -0.009857995438141226 efc_address: 4 contact pos: [-0.40873991 0.03358991 -0.004929 ] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 17 Distances: -0.00020977827648879788 efc_address: 8 contact pos: [-5.62732085e-01 2.77394218e-02 -1.04889138e-04] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 17 Distances: -9.482888690316715e-05 efc_address: 16 contact pos: [ 2.49840757e-02 1.25000000e-01 -4.74144435e-05] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 1 Distances: -0.00012236209308632943 efc_address: 20 contact pos: [ 3.53499315e-02 2.02367194e-01 -6.11810465e-05] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 4 Distances: -0.0004296991552439379 efc_address: 24 contact pos: [ 3.63990087e-01 2.06940783e-01 -2.14849578e-04] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 5 Distances: -0.00012528544422535197 efc_address: 28 contact pos: [-6.24649174e-01 2.02367007e-01 -6.26427221e-05] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 8 Distances: -0.0004286917380196646 efc_address: 32 contact pos: [-2.96009385e-01 2.06941396e-01 -2.14345869e-04] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 9 Distances: -0.00012236209308633637 efc_address: 36 contact pos: [ 3.53499315e-02 -2.02367194e-01 -6.11810465e-05] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 12 Distances: -0.0004296991552439379 efc_address: 40 contact pos: [ 3.63990087e-01 -2.06940783e-01 -2.14849578e-04] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 13 Distances: -0.00012528544422534503 efc_address: 44 contact pos: [-6.24649174e-01 -2.02367007e-01 -6.26427221e-05] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 16 Distances: -0.0004286917380196646 efc_address: 48 contact pos: [-2.96009385e-01 -2.06941396e-01 -2.14345869e-04] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 17 Distances: -0.017066778950418002 efc_address: 48 contact pos: [ 0.03899548 -0.20762763 -0.00853339] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 12 Distances: -0.0007069804345242528 efc_address: 52 contact pos: [ 0.03703317 -0.19806173 -0.00035349] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 12 Distances: -0.0007069804345242528 efc_address: 56 contact pos: [ 0.03666581 -0.21711075 -0.00035349] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 12 Distances: -0.003626807981501022 efc_address: 60 contact pos: [ 0.36609367 -0.2123678 -0.0018134 ] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 13 Distances: -0.016983413822198073 efc_address: 64 contact pos: [-0.62113526 -0.20783771 -0.00849171] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 16 Distances: -0.0006223953420279576 efc_address: 68 contact pos: [-6.23090523e-01 -1.98272464e-01 -3.11197671e-04] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 16 Distances: -0.0006223953420279576 efc_address: 72 contact pos: [-6.23453360e-01 -2.17321568e-01 -3.11197671e-04] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 16 Distances: -0.0037315908000181697 efc_address: 76 contact pos: [-0.29401127 -0.21251298 -0.0018658 ] Friction: [1.e+00 1.e+00 5.e-03 1.e-04 1.e-04] contact obj1: 0 contact obj2: 17 Distances: 0.0 efc_address: 0 contact pos: [0. 0. 0.] Friction: [0. 0. 0. 0. 0.] contact obj1: 0 contact obj2: 0 Distances: 0.0 efc_address: 0 contact pos: [0. 0. 0.] Friction: [0. 0. 0. 0. 0.] contact obj1: 0 contact obj2: 0 Distances: 0.0 efc_address: 0 contact pos: [0. 0. 0.] Friction: [0. 0. 0. 0. 0.] b. Which element in _mjContact I can use to determine that given given contact is active/detected contact? 2. Is there anyway to obtain contact data of two given body? like GetContact("body1", "body2")? I know I can maybe iterate through all the contacts and check geom1 and geom2 id, but it would be cool if we can get contact through xml attributes 3. How does the geom1 geom2 ids match XML? Is it by sequence? Is world_body (Say floor) id 0? Is there a C api to map a given id to xml Geom attribute? Or the other direction? Thank you very much!