Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
1
Question by Quazars · Oct 29, 2017 at 12:46 PM · 2d sprites

How to make parts of a 2D ragdoll not collide with eachother?

Hello all, I've tried creating a 2D ragdoll and it worked out great... except for one problem. Collision seems to be enabled between the different parts of the body. So for example I don't want leg 1 and leg 2 to collide with eachother how would I do that? Is there a specific thing I need to do in order to mark certain colliders as not collidable with eachother is is there something else I'm missing?

The ragdoll is created like a stick figure, feet are connected to legs which are connected to torso/body. Hands are connected to Arms which are connected to the torso/body. Head connected to torso/body.

Obviously I set the anchor/connected anchor at different points in order to make the rotation around that point. A side question is how would I make the anchor movable? I disabled the "auto configure connected anchor" and was able to move it freely to attach it how I want but the Anchor itself cannot be moved and is stuck in the middle unless I manually type in the X and Y values so that was a little annoying.

Appreciate any help! Thanks in advance.

Comment
Add comment · Show 1
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 pako · Oct 29, 2017 at 01:59 PM 0
Share

Please break up multiple parts of a problem into simple individual questions:

http://answers.unity3d.com/page/faq.html

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by pako · Oct 29, 2017 at 01:55 PM

You must first create a new Layer and assign it to the 2D ragdoll, including all its children:

https://docs.unity3d.com/Manual/class-TagManager.html

e.g. add a layer named "Ragdoll"

Then go to the Physics2D Settings and in the "Layer Collision Matrix" (at the bottom of the Settings), uncheck the layers that you don't want the Ragdoll layer to interact with. e.g. Ragdoll layer should not interact with Ragdoll layer:

https://docs.unity3d.com/Manual/class-Physics2DManager.html

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
1

Answer by dCalle · Oct 29, 2017 at 12:55 PM

well you could use this in OnEnable()

https://docs.unity3d.com/ScriptReference/Physics2D.IgnoreCollision.html

     public Collider2D[] colliders;
 
     void OnEnable()
     {
         IgnoreCollision(colliders);
     }
 
     /// <summary>
     /// Ignore Collision between all given Collider2Ds 
     /// </summary>
     public void IgnoreCollision(Collider2D[] colliders)
     {
         // < length -1 because the last doesn't need to ignore itself ;-)
         for (int i = 0; i < colliders.Length - 1; i++) 
         {
             Collider2D firstCollider = colliders[i];
             // loop through all colliders firstCollider has to ignore
             for (int j = i + 1; j < colliders.Length; j++)             {
                 Collider2D secondCollider = colliders[j];
                 Physics2D.IgnoreCollision(firstCollider, secondCollider);
             }
         }
     }
 

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

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.

Follow this Question

Answers Answers and Comments

76 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Making a 2D Ragdoll 2 Answers

Large Image/Sprite Renderer components cause FPS drop on device 0 Answers

2D RPG boomerang instantiation help. 2 Answers

Can you add sprites to existing sprite sheet without breaking the tile pallet and in-game tiles 0 Answers

Moving a 2D character along the X and Z axis only. 1 Answer


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