- Home /
ball is passing through Interactive cloth
Hi, I'm new to unity. I'm trying to create soccer game. I have set up the ball and goal post. For the goal post 'net', i used the interactive cloth. I taken 4 box collider for attachment. when i kick the ball sometime ball is passing through cloth. Also, the ball is also passing through the net if ball hits near the collider while it is good in the middle of net. when i tried to increase the density,ball is just sticking with net.
Cloth property as follow:
bending Stiffness : 1
Stretching stiffness : 0.5
damping : 0
thickness : 1.5
selfCollision unchecked
useGravity checked
Fiction : 0.5
Density : 0.8
Pressure : 0
Collision response : 0.4
Attachment Tear factor : 0.5
Attachment response : 0.2
Pls suggest me what should i change?
Hi, I'm having exactly the same problem. Also a soccer net, ball sticks or goes through. I am using two box attachment colliders across the top and bottom of the net. I cannot get any collider on the net to fire any collision events, trigger or otherwise. Have you had any jot with this problem? Density and Collision Response seem to be key in changing the dynamics, but it seems that the physics engine is not being used at all for cloth...
Answer by Ryuuguu · Apr 03, 2014 at 01:57 PM
cloth does not have a collider it has force interation. if you want a collider you can try this.
I do not know if this nonCPU intensive or not but it works. Make a separate game object with a mesh collider as child at (0,0,0) position relative to the cloth. put in in a lyer that does collide with the cloth. This gives a mesh collider that follows the cloth.
put this on the object
public InteractiveCloth cloth;
public Mesh mesh;
void Start () {
mesh = (Mesh)Instantiate(cloth.mesh);
GetComponent<MeshCollider>().sharedMesh = mesh;
}
void Update () {
calcFreqCount = calcFreq;
GetComponent<MeshCollider>().sharedMesh = null;
mesh.vertices = cloth.vertices;
GetComponent<MeshCollider>().sharedMesh = mesh;
}
Answer by flarespeed · Apr 29, 2014 at 12:45 AM
from what i've noticed, interactive cloth's collider is made of cylinders around the mesh. it does not appear to have faces in its collider, meaning the cloth acts sort of like a net. if an object is too small, it will simply pass through this net without touching it. i would suggest increasing the number of verts (lines) in your net model.