• 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 TheCraiggers · Feb 08, 2012 at 05:24 AM · transformfreezeparenting

Children's position going haywire (Unity bug?)

In order to do a camera trick, I have a script on all my objects that creates a few clones of itself containing only a mesh and material a set distance away. These clones are attached as children to the main object- the thought is that with no scripts or ridgidbodies or anything like that on the clones, they will rely entirely on the parent / children relationship to keep in sync movement-wise. This works really well right up until the parent collides with the ground.

Upon hitting the ground, the parent object freezes it's position to make it "stick". This works fine for the parent, but the children all kinda freak out at this point. I've done some debugging on this, and it looks like the problem lies with my freeze only the position - the rotation remains unfrozen. As soon as I tell the script to freeze the parent's rotation as well upon landing, the children all land in the correct fashion.

Also, and the reason why I kinda think this might be a unity bug (even though I hate questions that use that), is that a the amount the children move from their proper spot seems to change from one run to the next, with no script changes. Seems like that shouldn't happen. Also also, the transform.position does not change- the numbers always look correct.

Here is a screenshot so you can see what I'm talking about. The first shot is the white child flying away from a launcher object, microseconds before impact. The white balls are tracers I added to show the flight path of the object. As you can see, it looks straight. The next slide to the right shows what happens a moment later when it lands and jumps to the right for some god-forsaken reason. Again, although the screenshot does not show it, the parent object lands correctly and does not 'jump'.

Anybody have a clue what is going on here?

alt text

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 Berenger · Feb 08, 2012 at 06:56 AM

Maybe it's related to the rotation. Just to be sure, change the mesh Sphere by any other mesh, tobe able to see when it rotate. When the localpos of a children isn't null and there is a rotation, the child will rotate around the parent, not it's own axes. So that might be your problem. Sorry if I what point out is a little obvious.

Comment
Add comment · Show 1 · 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 TheCraiggers · Feb 09, 2012 at 02:12 AM 0
Share

No, I think you're onto something here. When I pause it in debug mode and look at the parent, the rotation does have some small numbers in the values for some reason, usually in the thousandths or smaller. This is probably something I should have looked at first, but I expected the terrain to be flat... at least I'm guessing that's why my objects suddenly have really small rotations applied to them once they hit the ground.

So, from this, I presume I'm screwed? I basically have to freeze rotation if I don't want the children jumping about?

This still doesn't explain why the rotation values change from one run to the next, however. I'll just assume this is due to how Unity handles the heightmap or something.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Moving child transform also moves parent rigidbody 0 Answers

Network.Instantiate parenting on other clients 1 Answer

Why do Transform have hierarchies and not GameObjects? 2 Answers

Object changes position/rotation, when moved (in/out of parent) in the heirarchy in the editor! 0 Answers

Freezing Transforms 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