• 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 Piesk · Feb 11, 2014 at 02:36 PM · parent-child

parents transform not affecting children

I have an object "Fleet" with several children "Squads", the squads are empty objects that have had a script applied. Once ships have been added, the 'strongest' one needs to be shown as the model of the fleet as the fleet moves around the map.

Each ship has a predetermined position (for formations at battle) and so i don't really want to be moving the leaders ship to the local (0,0,0) for map and move it back again (but i have a feeling my problem would persist even if i did).

And so my idea was that when a leader is chosen, clone it and parent it to the fleet. So now the fleet contains: leaderObject, squad , squad , squad. for example.

When the fleet moves, I am using transform.lookat to point it in the right direction before moving forward. The squads are all fine (checked with testing with no leader object). But when the leader object is added, instead of moving in the positive x direction, the entire object moves in the positive Y direction.

At first i thought it was because the leaderobject's rotation.x was 270, but after changing that to 0 the problem persists. I can only assume that while transform.lookat is rotating the object itself, it is not rotating it's children, so that when using controller.move(forwardDirection), the parent seems move in the forward direction of the child leaderobject instead.

Since the last update i've noticed a lot of odd behavior like this, is there any documentation any where that explains the new relationship between parents and children?

Thanks for any help.

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 DajBuzi · Feb 11, 2014 at 02:58 PM 0
Share

I've read your 2 questions, release notes, change logs and havent found a nything about new parent-child behavior. I would recommend you to re-check all your calculations, debug each change in code.

I'll try to "recreate" your work in some projects and let you know if i have the same odd behacior.

avatar image Piesk · Feb 11, 2014 at 04:35 PM 0
Share

thanks very much i appreciate it, i will do.

avatar image Piesk · Feb 11, 2014 at 04:45 PM 0
Share

one thing i considered, is it possible that because fleet is an empty object, and it's child is not an empty (it is currently a cube) that when finding 'transform.forward' it looks to the child for it's forward vector?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Piesk · Feb 13, 2014 at 10:33 AM

I realized that I would not need the majority of the "Avatar" object's components and so i removed those that weren't essential, this solved the problem and so i did a step by step to confirm my suspicions that it was the mesh collider that was causing the problem. I don't understand why, but for some reason the mesh collider was 'causing the object to move in the wrong direction.

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.

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

19 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

Related Questions

GameObject Parent-Child instantiation order 2 Answers

Script that mimics a child object behavior. 1 Answer

Move Parent Along Childs Local Axis 1 Answer

Relative transforms and parenting 1 Answer

How can I synchronize Instantiated children of a GameObject over Photon? 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