• 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 UnityNoob123 · Nov 04, 2017 at 04:56 AM · physicsboxcollider

Box Collider Child Effecting Parent Movement

Hi, I am trying to make my zombie gameobject's head explode, so I took his head and made it into 16 cubes or so. The setup right now is that each cube has a box collider on it along with a rigidbody, and when the raycast hits the object an addforce is applied to that cube to make it look like the head is exploding. Only problem is that with the box collider being a child of the zombie prefab, it makes the model spin uncontrollably. As soon as I disable the box colliders, it all returns to normal. I thought that all the box colliders were too close together so I scaled the boxes down, no luck. I then only tried it with one box collider and it still was occurring. I made the cubes have a different layer and disabled the layer in the collision matrix, nothing. I have no idea what is going on!! Any help is appreciated, I made sure the colliders were not hitting any other colliders as well.

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 MaxGuernseyIII · Nov 04, 2017 at 05:02 AM

There is probably something more elegant but a pretty common solution seems to be one of the two following options:

  1. Have the parts of the zombie's head be able to instantiate a prefab in their place and destroy themselves. The originals wouldn't have the colliders, only the prefabs and their instantiations.

  2. Have the colliders be turned off until you want the zombie's head to explode, then unparent the parts of the head, turn on all the colliders, and add the force.

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 UnityNoob123 · Nov 04, 2017 at 06:05 AM 0
Share

@$$anonymous$$axGuernseyIII The thing is I want just one cube to get shot off at a time, not all of them at once. And I believe the only way to do that is if all of them have their own colliders for raycast detection.

avatar image MaxGuernseyIII UnityNoob123 · Nov 04, 2017 at 06:44 AM 0
Share

You could try the un-parenting option pretty easily. As soon as a collision is detected, "snap off" the piece you want to fly away. You can also create a game object that is the parent for both the zombie and the pieces that fly away. Then have the stuff that moves it drive that virtual parent and unparent the pieces as soon as a collision is detected.

avatar image
1

Answer by UnityNoob123 · Nov 04, 2017 at 06:43 AM

I found it, when I made a new layer for the head detection, it somehow automatically set the player raycast mask that my zombie ai used to also have the zombie head layer along with the player layer. Thus making my zombie attack its own head which made it glitch out. Thanks for saying it could be more "elegant" because that made me dive deeper into the problem.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

126 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 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

Strange car beahaviour 0 Answers

Box Collider z Axis unwanted reset 5 Answers

BoxCollider get stuck when dragging over the border of two BoxColliders 1 Answer

Collider Displacement Issue 0 Answers

C# new BoxCollider() returns null? 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