title: Prevent force-dragging bodies through other bodies with MatterJS
body: <p>I'm using MatterJs for a physics based game and have not found a solution for the problem of preventing bodies being force-dragged by the mouse through other bodies. If you drag a body into another body, the body being dragged can force itself into and through the other body. I'm looking for a reliable way to prevent them from intersecting. You can observe this effect in any MatterJS demo by selecting a body with the mouse, and trying to force it through another body. Here is a typical example:</p>
  
  <p><a href="https://i.stack.imgur.com/N9oe1.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/N9oe1.gif" alt="enter image description here"></a></p>
  
  <p><a href="https://brm.io/matter-js/demo/#staticFriction" rel="noreferrer">https://brm.io/matter-js/demo/#staticFriction</a></p>
  
  <p>Unfortunately this breaks any games or simulations depending on drag-and-drop.
  I have attempted numerous solutions, such as breaking the mouse constraint when a collision occurs, or reducing constraint stiffness, but nothing which works reliably. </p>
  
  <p>Any suggestions welcome!</p>