Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by kboudai · Jun 26, 2014 at 03:10 AM · 2dcollidercompound collider

Does Unity support 2D compound colliders?

I made several failed attempted to use compound collisions with BoxCollider2D and RigidBody2D. The onCollision 2D events, like onCollisionExit2D, are never called in the parent. Are 2D compound colliders supported? If so, how did you get them to work?

My parent and child tree that forms the compound collider:

 GameObject
 |- attached components
 |  |- SpriteRenderer
 |  |- Script
 |  |- RigidBody2D
 |  |- BoxCollider2D
 |
 \_ GameObject
    |- attached components
       |- SpriteRenderer
       |- BoxCollider2D


I found several references in Unity Answers on the topic, but they either conflict or have no answer. For example, the following questions have conflicting answers and comments: http://answers.unity3d.com/questions/652188/compound-colliders-not-working-in-2d-unity.html http://answers.unity3d.com/questions/423378/how-do-you-create-complex-collision-geometry-to-ma.html

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Pyrian · Jun 26, 2014 at 05:49 AM

In 4.3, collision events on the parent GameObject's script will not be called. In 4.5, they will. In either case, you can catch the events by attaching a script to the GameObject with the collider component.

Comment
Add comment · Show 2 · 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 kboudai · Jun 26, 2014 at 06:23 PM 0
Share

How, from where, did you learn that information? I searched the docs, but after finding http://docs.unity3d.com/$$anonymous$$anual/CollidersOverview.html realized that the docs erroneous, both the online docs and the docs included in the version of Unity I have installed.

avatar image Pyrian · Jun 26, 2014 at 08:00 PM 0
Share

Oh, I learned it the hard way in all cases. First, in 4.3, I tried catching events at the RigidBody2D level, and when that didn't work, I added scripts to the child object colliders to catch the events and pass them up. That worked...

...Until 4.5, where the events would get called in both the parent and the child, breaking my game. So, I had to fix things again...

The change is in the 4.5 release notes:

•Physics: Collision and trigger callbacks now occur on both the GameObject containing the 2D collider as well as the GameObject containing the 2D rigid-body.

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

2 People are following this question.

avatar image avatar image

Related Questions

Ignore child intercollision, not parent-parent 0 Answers

OnTriggerEnter and OnTriggerExit both trigger twice 0 Answers

C# Invalid Points Assigned to 2D Edge Collider 1 Answer

List of gameobjects attached to single object 0 Answers

Unity2D - Box Collider 2D problem 0 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