- Home /
Colliders don't collide.
Hi! To illustrate the problem: So I want to make a physical chain. I made a chain module mesh and want to make a compound collider for it. Now I'm trying to do it with 6 child box colliders trying to simulate a real chain. The first chain module is a kinematic rigidbody(because I don't want it to fall), the second one is not kinematic. So the problem is that colliders does't collide at all. I placed a cube beniath and the chain modules collides with the cube. Why it doesn't collide with the first chain module? The Unity says: "Invalid parameter because it was infinity or nan."
Another question: When I start to move the cube up and down during the runtime the chain module that falls on the cube starts to jump on it(predictable and right), but after a number of such jumps it just goes through the cube and continue falling, so somehow it doesn't collide with the cube as well. Or a similar situation: two objects with box colliders. One is kinematic, the other a regular rigidbody, which falls on the kinematic one and stops and everything is ok, but when I rapidly move the kinimatik rigidbody in the runtime, the other, which until this moment laid still, falls through the kinimatic rigidbody. Is it possible to prevent this somehow?
What is the problem?
UPD
Here is what I want to achive:Chain mesh is a rigidbody and 6 box colliders. Even when I don't move objects in the editor window the chain breaks. I can't attach more then 6 parts. Is it the right way to simulate a chain?
Answer by 3dDude · Jul 25, 2010 at 01:19 PM
i made a chain creator script in this forum topic :
Great! It may be what I'm looking for!But how exacliy does it work? I have a torus mesh and an empty chain segment I can I assign a mesh to. As far as I understand the chain mesh is for demonstration purpose only and the main thing is empty chain seg with joint. I also have two scripts. Where is to be assign to work properly? I assign everything to the empy chain(with an assigned mesh to it) and Unity says "Null reference exeption. The prefab you want to instanciate is null" I'm going to play with it now, but if you could give a brief explanation it'd be greate! Anyway thanks for the script!
ok there was a problem with the package try downloading it again.
just drag the ChainCreator prefab someplace in you scene and it will make a chain when the game starts
also make a tag named "Chain" and give that tag the the chain link
I works. But all chain links are not movable. Is it possible for example to attach one end of the chain to, say, a kinematik rigidbody so that when I move transform of that body the chain would also move with it and the other end to another kinematik rigidbody so that the chain would behave itself as a chain(sagging). Or to attach the other end to a hook to which to attach another object as a weght. I mean I don't understand weather it is possible to use your chain as a real physical chain, the problem is that I don't see how I can attach objects to it because it is created during the runtime.
Answer by spinaljack · Jul 25, 2010 at 01:45 AM
Are you dragging objects around in the editor at runtime? Clearly this isn't meant to happen during a game so you'll see errors in physics when you move and object past a collider.
Kinematic rigid bodies have no physics calculations on them and wont trigger collisions.
The second problem with objects that are lying still is not a bug. Rigid bodies will "sleep" when below the sleep velocity threshold (which you can set in the editor). Sleeping rigidbodies don't perform physics calculations which saves processing time and allows you have a large number of objects on a scene so long as they remain still most of the time.
You can test this by writing if(rigidbodiy.isSleeping) print("sleep"); in a script.
Answer by jonas-echterhoff · Jul 25, 2010 at 12:01 PM
It seems that your method of simulating a chain is overly complex, and probably not going to be stable for too many links (as you stated) by the physics engine. Instead, try making each chain link a single rigidbody with a single collider, and connect them to each other using joints. That should be much more stable, plus you get more configuration options, like how much force is needed to tear the chain.
Thanks! I'm defenetly going to give it a try. $$anonymous$$y scheme doesn't work the way I want.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I create a realistic chain with interlocking rings and accurate physics? 0 Answers
OnCollisionEnter isn't working between two RigidBodies 1 Answer
What is the best way to check is object intersecting? 1 Answer
Character Controller Pushes Car With Wheel Colliders? 0 Answers
Fastest primitive collider 1 Answer