code: function applyFrictionByAxis(axis, body, dvel) {
      // friction applies only if moving into a touched surface
      var restDir = body.resting[axis]
      var vNormal = dvel[axis]
      if (restDir === 0) return
      if (restDir * vNormal <= 0) return
  
      // current vel lateral to friction axis
      vec3.copy(lateralVel, body.velocity)
      lateralVel[axis] = 0
      var vCurr = vec3.length(lateralVel)
      if (equals(vCurr, 0)) return
  
      // treat current change in velocity as the result of a pseudoforce
      //        Fpseudo = m*dv/dt
      // Base friction force on normal component of the pseudoforce
      //        Ff = u * Fnormal
      //        Ff = u * m * dvnormal / dt
      // change in velocity due to friction force
      //        dvF = dt * Ff / m
      //            = dt * (u * m * dvnormal / dt) / m
      //            = u * dvnormal
      var dvMax = Math.abs(body.friction * vNormal)
  
      // decrease lateral vel by dvMax (or clamp to zero)
      var scaler = (vCurr > dvMax) ? (vCurr - dvMax) / vCurr : 0
      body.velocity[(axis + 1) % 3] *= scaler
      body.velocity[(axis + 2) % 3] *= scaler
  }
docs: /*
  FRICTION