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
1
Question by Ivan Leben · May 25, 2010 at 11:52 AM · collisionrigidbodytriggermessage

Rigidbody Trigger Collider vs. Static Collider no OnTriggerEnter message

According to the Trigger message table here http://unity3d.com/support/documentation/Components/class-BoxCollider.html a Rigidbody with Trigger Collider should get an OnTriggerEnter message sent in all combinations. However, in my case this doesn't work.

I've got a non-kinetic rigidbody with a compound collider (many child objects, each with a trigger box collider). There is no collider on the parent rigidbody object. The rigidbody object passes another object in the scene, with a static box collider (non-trigger). The rigidbody object does not get any OnTriggerEnter message sent. However, I do get OnTriggerEnter message sent if I make the other object's collider a trigger as well.

Is this setup supposed to work?

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 Ivan Leben · May 25, 2010 at 12:19 PM 0
Share

Btw, I tested it some more and figured the OnTriggerEnter message gets sent to the child object's with trigger colliders, but not to the parent rigidbody object. Since the message does get sent to the parent compound rigidbody in the case of OnCollisonEnter, I would expect the same to happen with OnTriggerEnter message. Is there a way to make that happen?

1 Reply

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

Answer by jonas-echterhoff · May 25, 2010 at 12:53 PM

As you said yourself, trigger messages are sent to the object with the collider, not to the Rigidbody - this is because unlike static colliders, triggers are not (AFAIK) treated as compound colliders, so you'll get enter/exit messages for each trigger. To get the messages on the Rigidbody, you could make a simple script to iterate the parent hierarchy, until it finds a Rigidbody, and send the message to that.

Comment
Add comment · Show 3 · 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 Ivan Leben · May 25, 2010 at 01:28 PM 0
Share

Yup, that's what I did, it is just a little annoying from the programmer's point of view since you usually want to work with compound colliders on the high level, rather than adding scripts to all the children just so you could handle triggers as well. I'd love a feature added where trigger colliders are treated as compound colliders too.

avatar image shaystibelman · Nov 13, 2012 at 08:14 AM 0
Share

can't you just do findComponentsInChildren and pass them whatever you want the trigger to... trigger?

avatar image Rafes · Jul 14, 2013 at 10:51 PM 0
Share

I suppose you could put the script on the rigidbody gameObject and implement it as a "manager" which installs a simple "sensor" script on to all child trigger colliders and then uses a list to manage the common states. this would be much faster than using messages and bubbling up from the child.

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

Change size and mass on collision 1 Answer

Detect 2 non kinematic triggers? 3 Answers

Can't add Rigidbody component because collision prevents it 2 Answers

How to detect in grid of objects if one is destroyed while beside adjacent objects without rigidbody? 1 Answer

Collider2D/RigidBody2D not working 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