So i use cloth component for the net. After setting up it works fine. The problem is that the cloth don’t interact with the balls (GameObject Prefabs).
But when i create a sphere in the scene (with rigidbody and sphere collider, like GameObject prefab), the cloth interact with the sphere.
How can i make the cloth interact with prefab GameObject?
There are two types of cloth in Unity, the Cloth (fast) component and the Interactive Cloth (slow) component. On the Cloth component you have to attach your collider to the Cloth, to define that the collider can interact with the Cloth. The Cloth inspector window has an array for the possible colliding collider.
The interactive cloth is more expensive (cloth simulation), it collides without attaching the colliders on it.
First you declare an array of capsule colliders
public CapsuleCollider[ ] colliders;
then you call this code in any function when instantiating the prefab
///////
Cloth b = Object.GetComponentInChildren (); //get the cloth from the gameobject
colliders = new CapsuleCollider[4]; // can be any size you like
//set the colliders from the gameobjects in the scene