• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by h0stis · Jul 24, 2010 at 09:29 PM · physicscolliderchain

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by 3dDude · Jul 25, 2010 at 01:19 PM

i made a chain creator script in this forum topic :

http://forum.unity3d.com/viewtopic.php?t=59366

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image h0stis · Jul 25, 2010 at 02:16 PM 0
Share

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!

avatar image 3dDude · Jul 25, 2010 at 04:24 PM 0
Share

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

avatar image 3dDude · Jul 25, 2010 at 04:27 PM 0
Share

also make a tag named "Chain" and give that tag the the chain link

avatar image h0stis · Jul 25, 2010 at 07:26 PM 0
Share

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.

avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image h0stis · Jul 25, 2010 at 02:19 PM 0
Share

Thanks! I'm defenetly going to give it a try. $$anonymous$$y scheme doesn't work the way I want.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How do I create a realistic chain with interlocking rings and accurate physics? 0 Answers

Trying to use colliders on trees to interact with player 1 Answer

Rigidbodies won't collide if mass difference is too high 0 Answers

Detailed terrain mesh collision 1 Answer

FPS Tutorial Waypoints question 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges