Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 /
avatar image
0
Question by kcazyz · May 21, 2013 at 04:00 AM · physicsrigidbodyaddforceparentchild

Child Gameobjects are not fixed to the parent when using physics

I am trying to make a flight simulator-type game, but I am having problems with the child gameobjects of the rigidbody. At the top level I have the root gameobject which contains the model, the rigidbody, and the airplane script. Then, that game object has a bunch of empty gameobject children that I use to set the position to apply forces. Each one of those gameobjects has an airfoil script which applies it's own forces on the main rigidbody using AddForceAtPosition.

I have been having some problems, however, and after some debugging I found that the position of the empty gameobjects relative to the root are moving. The local position stays the same, but if I log the root transform.position - an empty gameobject position I have noticed that that fluctuates quite a lot. Shouldn't this stay constant?

Do you think this has anything to do with AddForceAtPosition?

Comment
Add comment · Show 3
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 Fornoreason1000 · May 21, 2013 at 04:08 AM 0
Share

yes they should be moving...

transform.position shouldn't be constant if its moving. if you move a parent EVERYCHILD moves with it...`LocalPosition` is the position offset from the parent while Position is global...that's why local position didn't change and transform.position did.

And if your parent is moving, then so will be your child objects. why they do that is for practical reasons. e.g a player is carrying a gun, you add force to the player.. you want the gun to move with the player.

to fix your problem here's a hierarchy chart:

   -RigiBody
   -ContainerForEmpties 
        -Empty(s)
 
  

 


 
avatar image kcazyz · May 21, 2013 at 04:55 AM 0
Share

I know I expect them to be moving, but they move incorrectly relative to each other. What I said was the difference between the global positions isn't constant. I ended up lowing the timestep and that fixed the problem for the most part. It seems like because the empty gameobjects that had the airfoil code were taking more time to do calculations they were a step or two behind everything else. This is why when the velocity was large they didn't move exactly with the parent.

avatar image Fornoreason1000 · May 21, 2013 at 05:46 AM 0
Share

Ok, Now I understand, sorry for that. I was confused since you said

The local position stays the same

and then

log the root transform.position

Anyway back to the problem heres something on Airfoils for your physics. http://en.wikipedia.org/wiki/Airfoil

and AddForceAtPosition Could Be it http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.AddForceAtPosition.html

I'm not sure if that's the right approach or not

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

14 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

Related Questions

Is it possible to prevent parent rigidbody physics from effecting children rigidbodies? 1 Answer

Make a simple tree 1 Answer

Child rigidbody clipping through walls. 2 Answers

Child rigidbody acting strange when moving parent. 0 Answers

" You should never have a parent and child rigidbody together " ? 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