Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 nastajus · Jan 02, 2020 at 07:17 PM · addforcehierarchyjointspositioningparent and child

I have a bug where addForce leaves behind some objects - any ideas?

alt text

Bug video short: https://www.youtube.com/watch?v=E9TGK_P9Jg0

How this works: I'm adding force to a child object, thrusters, and normally that won't move the parent object (the entire ship). But I added a fixed joint to the root transform, connected to the thrusters, so now it moves almost all of the ship! Except the turret part! The turret part is a child of the root transform, like the rest of the ship. So it should move too! But doesn't! I have no idea why this particular part is left behind when forces are applied. Even rotation, as clunky as it is now, shows the parenting works... for rotation only!

So far to fix I tried: disabling the only "different" script attached to the turret sub-hierarchy, for laser, since that controls it's own independent rotation... no change... And the root is a variant, that shouldn't matter though... And I've checked there's no rigidbodies set to kinematic... most the ship has no rigidbodies, just the thrusters and root right now with just default settings...

I have no idea what's up... Any ideas Unity Answers?

alt text

addforce-leaves-child-behind-1080.png (319.4 kB)
addforce-leaves-child-behind-but-it-is.png (241.0 kB)
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by nastajus · Jan 02, 2020 at 07:47 PM

Ok, so I just figured it out after posting this. So I'd designed my scripts to be as minimalist as possible, where just attaching it handles everything else. And one of the things it the laser script does for convenience -- which I'd forgotten until I just tried re-attaching it and retracing it all now from scratch -- is it dynamically adds rigidbody at runtime.... and the default rigidbody settings are problematic.

So by changing the turret's default rigidbody to enable kinematic, the turret follows the ship now.

And the rigidbody gets added during Awake. So even though I disabled the script in my initial debugging attempt, Awake still executes, so the Rigidbody still gets added, unbeknownst to me.

What I don't understand is why I don't need kinematic on most-child thruster gameobjects, nor on the most-parent root object, but I do need it on the middle-of-hierarchy gameobject for the turret?...

Can someone explain that?

Edit: I recall reading somewhere that parent rigidbodies kind of ignore/absorb child rigidbodies, or something like that...

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

118 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

Related Questions

Access GameObjects Parents and Childs from any level of hierarchy 0 Answers

How do I move both the parent and child to a known position where I want the child to be? 1 Answer

Rigs, performace, optimize game object, expose extra transforms. Questions, questions, questions... 0 Answers

Trajectory problem with addforce coordinates 1 Answer

Rigidbody has zero velocity but still moves 2 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