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 Palimon · Aug 20, 2014 at 03:49 PM · rigidbodycolliderhierarchy

How do RigidBodies and Hierarchy affect child objects' colliders?

I've been trying to get a simple object-as-button to work correctly for almost two weeks now, and I've seen some very strange (to a new user of Unity) behavior with colliders and mouse events. A good overview of my project: alt text

You can't see it in the screenshot, but Spaceship 1 is a RigidBody. My desired functionality is to have Spaceship 1 a rigidbody, and the child objects (Central Console and Control Pedestal) to stay where they are relative to Spaceship 1. After hours of frustration trying to get my OnMouseEnter debug statement to fire, I finally bumped into these:

  1. If I add a RigidBody component to Control Console, all mouse events work perfectly when I mouseover or click on Control Console.

  2. If I remove the RigidBody component from Spaceship 1, all mouse events work perfectly.

  3. If I move Control Console to the root of Hierarchy, so it's no longer a child of Spaceship 1, all mouse events work perfectly.

Question: I obviously am not understanding a few things here. I definitely need to learn more about how parent objects affect child objects, but I haven't seen anything in the Unity docs or API that suggests a parent affects colliders. Anyone have some knowledge/links they can share on this subject?

project.png (380.8 kB)
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 _dns_ · Aug 20, 2014 at 04:07 PM 0
Share

Hi, I would recommend using raycasting to detect objects under mouse and clicks. This will allow you to use physics layer masks to choose what object can be hit or not, test if one specific object is under the mouse or not anywhere in the code, have some more accurate 3D space coordinates of the point clicked so you can spawn some particles to give feedback to the player... It will also be more flexible when your project grows. There are lots of examples on the web and resources on the asset store on the subject.

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

I'd like to simulate a fish. 0 Answers

OnCollisionEnter of Projectile detects parent with rigidbody instead of child objects with collider 2 Answers

Dynamically parenting a collider object to a rigidbody object causes collision bug. 1 Answer

Excluding some physics collisions 3 Answers

Avoid overlapping of random spawned prefab 3 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