title: Unity. Disable collision physics but have method for collision called
body: <p>Basically, i have player object and bunch of other. For this moment they all have <code>RigitBody2D</code>, and colliders, code for creating:</p>
  
  <pre><code>        obj = new GameObject();
          obj.tag = "web";    
          obj.name = "web";
          float randomX = Random.Range (Utilities.getMainCameraBounds ().min.x, Utilities.getMainCameraBounds ().max.x);
          float randomY = Random.Range (Utilities.getMainCameraBounds ().min.y, Utilities.getMainCameraBounds ().max.y);
          obj.transform.position = new Vector3(randomX, randomY);
          obj.transform.localScale = new Vector3 (3.0f, 3.0f, 3.0f);
          collider = obj.AddComponent &lt;BoxCollider2D&gt;();
          body = obj.AddComponent&lt;Rigidbody2D&gt; ();
          body.constraints = RigidbodyConstraints2D.FreezeAll;
          joint = obj.AddComponent&lt;HingeJoint2D&gt; ();
  
          renderer = obj.AddComponent&lt;SpriteRenderer&gt;();
  
          renderer.sortingOrder = 1;
  
          renderer.sprite = Resources.Load("Textures/dot_net", typeof(Sprite)) as Sprite;
  </code></pre>
  
  <p>Purpose for this is to catch collision like this : </p>
  
  <pre><code>void OnCollisionEnter2D(Collision2D collision) {
      if (collision.transform.tag == "web") {
          Player.getInstance().joint(collision.rigidbody);
      }
  }
  </code></pre>
  
  <p>After player collides with some of those objects, method <code>joint</code> called, it's purpose to connect <code>player</code> and <code>web</code> with <code>HingeJoint2D</code> to simulate pendulum behvior. Code of <code>joint</code>:</p>
  
  <pre><code>public void joint(Rigidbody2D body) {
      WebCollection.getInstance ().turnOffColliders (body.gameObject);
      HingeJoint2D hingeJoint = webLine.getObject ().AddComponent&lt;HingeJoint2D&gt; ();
      hingeJoint.connectedBody = body;
      hingeJoint.anchor = new Vector2 (0.00120592f, 0.1921938f);
      hingeJoint.connectedAnchor = new Vector2 (0.1939605f, 0.03025406f);
  }
  </code></pre>
  
  <p>Pendulum behavior is working just fine, but in moment of it, or just when player is moving towards web, other <code>web</code> objects are colliding with it, creating real colliding behavior(like crushing into each other)</p>
  
  <p><strong>My goal:</strong> i want <code>web</code> objects to react on the collision(calling method above), but on the screen to player just go throw them. </p>
  
  <p><strong>What i've already tried:</strong> I wanted to turnOff other objects bodies (<code>WebCollection.getInstance ().turnOffColliders (body.gameObject);)</code> and after pendulum movement is over, to turn them back, but it causes very strange behavior. </p>
  
  <p>What also can be a solution is to manually checking if player is colliding with <code>web</code> object right now, and handle it, but this is to costly i think. </p>