Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by Aedous · Oct 30, 2015 at 10:12 PM · collisionphysicsrigidbody2dphysics2d

Rigidbody2D and non-trigger child colliders!

Hello!

I have a simple question with colliders and rigidbodies just for 2D. I have a character gameobject with a Rigidbody2D attached to it with a circle collider, this also has a child gameobject with an extra collider in the child which is not a trigger. Now considering that the character is always going to be moving around, must I have a Rigidbody2D also attached to the child colliders?

The reason I'm asking is because I've read around on the interwebs that if a "solid" collider does not have a Rigidbody attached to it Unity assumes this collider is static and does not move and therefore saves on performance. So does the fact that the parent collider has a Rigidbody automatically let Unity know that these other solid child colliders will also be moving around?

Any help will be really appreciated :D.

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 Statement · Oct 31, 2015 at 12:16 PM

So does the fact that the parent collider has a Rigidbody automatically let Unity know that these other solid child colliders will also be moving around?

I don't know the internals of the 2D physics system, but the 3D physics system works (or at least worked like this some time ago when I was exploring it more in detail):

If you have a gameobject without a rigidbody, with any colliders, all non-rigidbody colliders will be rebaked if any of those object moves.

If you have a game object with a rigidbody, with any colliders, colliders will not be rebaked if you move the rigidbody.

If you have a game object with a rigidbody, with any colliders, colliders will be rebaked for that rigidbody if any of its colliders move relative to the rigidbody.

That is to say; given you have a rigidbody A and colliders B, C, and D

  • A
    • B

    • C

    • D

Then moving B, C or D will rebake the collision data only for A, not the entire scene. If you want to move B, C and D without performance hits for rebaking (even if it's only limited to that particular rigidbody) then B, C and D should have kinematic rigidbodies.

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 hexagonius · Oct 31, 2015 at 11:30 AM

The root Rigidbody2D takes the children into account and forms a larger collider out of all of them. If you're past Unity 4.5. No performance impact here.

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

34 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

Related Questions

RigidBody becomes awake without a collision 1 Answer

Adding velocity to an object in a brick breaker game 0 Answers

Platforming character is jumping higher while walking 0 Answers

Is there an easy way to make a RigidBody2D collide with only one other RigidBody2D? 1 Answer

Why/How 2d tower of blocks collapse? 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