def nearCallback (data, o1, o2):

  ## exit without doing anything if the two bodies are connected by a joint
  b1 = ode.dGeomGetBody(o1)
  b2 = ode.dGeomGetBody(o2)
  if b1 and b2 and ode.dAreConnected (b1,b2):
    return

  ## @@@ it's still more convenient to use the C interface here.

  contact = ode.dContact()
  contact.surface.mode = 0
  contact.surface.mu = ode.dInfinity
  if ode.dCollide ( o1,o2,0,contact.geom,sizeof(ode.dContactGeom) ):
     c = dJointCreateContact (world.id(),contactgroup.id(),&contact)
     ode.dJointAttach (c,b1,b2)