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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
2
Question by TheWyrdsmith · Apr 07, 2012 at 02:29 PM · physicsrigidbodyparenting

Parenting Rigidbodies to Rigidbodies (Newtonian Space)

Good evening everyone.

I'm sorry if I should have been able to find the answer to this myself. I have tried, and failed.

I've got a simple space game. I want the character's object to be able to walk around inside his ship as well as pilot it. I've got state changes working fine, no issues there, but if you leave the pilot's position after adding some force (the player is kinematic while piloting) you then get left behind by your ship, or at best spun around inside the cockpit. How should I fix this?

The player's object needs to inherit changes in rotation and position, in the same way a parent-child transform hierarchy does, but also have its own movement abilities.

Joints are out because I need relative movement (unless it can be done with ConfigurableJoint, but I can't see how). I can't just use transforms or isKinematic on the character because that will just delay the issue until small ships have to dock inside big ships. Parenting the transform normally doesn't cause motion to be inherited. I've tried having them parented from scene start and dynamically parenting. It doesn't seem to make a difference whether the child is under the root ship object (with rigidbody) or some child object (no rigidbody, which is strange because it should work fine...)

If I switch to Editor while the ship is spinning and manually move it using Gizmos, then the character moves along with it, no issue.

My only solution would be to recursively apply any force to all child rigidbodies as well, but then there's pivot point problems and it will get stupidly expensive for ships with large hangars.

Quick View:

  • A parent rigidbody makes changes to a transform.

  • All non-rigidbody children behave as expected.

  • Any rigidbody children do not inherit the parent's changes.

  • I need them to.

Thank you for your time and help,

James.

Comment
Add comment · Show 2
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 aldonaletto · Apr 07, 2012 at 04:51 PM 0
Share

I tried a rigidbody pilot childed to a rigidbody ship, and it worked fine - better yet when the pilot was set to kinematic: it always followed the ship, no matter which external forces were applied to the parent.

avatar image TheWyrdsmith · Apr 08, 2012 at 05:13 AM 0
Share

I can easily reproduce my issue, I'd like to know how you avoided it:

Create two default Cubes, apply rigidbodies Deactivate Gravity in Edit>Project Settings>Physics (makes things easier to see) Add a ConstantForce to both of them, one pointing Z+ and one X+ $$anonymous$$ake one the child of another If you play, you'll find they go off on their separate axes... However, the expected behaviour is that both should move with the parent's ConstantForce, and one should move in a different direction as well due to its own ConstantForce, resulting in a diagonal line movement.

How were you applying your forces? I'm aware that it works when the pilot is kinematic, but sadly that's not an option for me.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Attaching multiple rigidbodies together and spawnning as prefabs 1 Answer

Parenting Rigidbodies without using Kinematic 1 Answer

Child rigidbody clipping through walls. 2 Answers

Parented Rigidbody Collisions 0 Answers

Attaching Rigidbody breaks gravity 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