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 Sam At FPStudios · May 27, 2010 at 04:59 AM · rigidbodycolliderchildrencompound

Animated character with simple colliders on joints - rigidbody not finding child colliders.

Short question - Do rigidbodies only use (compound) colliders in their immediate children or should they search down the entire heirachy for colliders?

More detailed info - I have a character model imported from somewhere (3dsmax I think) and I'm moving it around manually and playing animations when needed.

The model is set up like normal I think .

Base    
  -> Pelvis         
    -> Spine
      -> L Thigh
      -> R thigh 

ect.

What I want to do is have this character knock things over in the scene when it moves around. So I attached a kinematic rigidbody to the base element, and I have a script on that that listens for collision events.

Then I add simple sphere or capsule colliders to a few of the joints. Like one on each leg, foot, arm, hand etc.

Now, it seems that a rigidbody will only use the colliders that are in it's immediate children, rather than searching down the heirachy to find all the colliders that exist.

Is that correct? When I put a big box collider on the Pelvis element (directly under the object with the rigidbody and script) it seems to work, but when the colliders only exist much further down the chain (feet etc) I get no collisions.

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

2 Replies

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

Answer by Sam At FPStudios · May 27, 2010 at 11:19 PM

I posted this on the other forum and mod andeeee posted this response which explains what I was seeing.

A rigidbody incorporates colliders on all its descendants, not just immediate children. However, colliders on moving child objects will not necessarily give the right effect

Child objects that are moved (say by an animation) might be better handled by having their own kinematic rigidbody each. Each limb can have a script that informs the root object of collisions if necessary.

That makes sense now. Since my colliders were being moved by animations, the rigidbody at the root level was not picking up their collisions or triggers.

So, it looks like putting a Kinematic Rigidbody, Collider and simple script on each limb is the way to go.

Just tested that out and it works fine. The script on the limbs just uses SendMessageUpwards to send collision/trigger messages up to the root. Fairly simple.

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 StephanK · May 27, 2010 at 08:57 AM

OnCollisionEnter() should be called on your parent GameObject that has the rigidbody regardless how deep the collider is in the hierarchy. At least that's how it works for me. You said you have a kinematic rigidbody. Kinematic rigidbodies won't trigger OnCollisionEnter() unless they collide with a dynamic rigidbody. Maybe that's your problem?

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 Sam At FPStudios · May 27, 2010 at 11:22 PM 0
Share

Thanks for the attemp spree, but I think I've found the answer below. Animations was the problem.

I probably didn't explain it above but my parent kinematic rigidbody is colliding with both dynamic rigidbodies (OnCollisionEnter) and trigger colliders (OnTriggerEnter) and I was listening for both and getting nothing.

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

No one has followed this question yet.

Related Questions

Rigidbody will overwrite children colliders, and collision events won't run. -5 Answers

How to raycast a child collider of a parent rigidbody 2 Answers

Adding rigidbody engages children colliders? 2 Answers

Create a compound collider (beginner) 2 Answers

Enemy Cube going through walls. 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