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 /
avatar image
1
Question by zico_mahilary · Nov 02, 2012 at 10:43 AM · positionparentlocalglobal

child object does not show position change in editor even though it is rotating with its parent.

i have instantiated an object and made it a child to another gameobject which constantly rotates so that it rotates along with it too. after this, when the instantiated object reaches a certain position, another clone of the same object is supposed to spawn at the same place where the first one was spawned... and so on. basically i am trying to maintain a constant gap between spawned objects which have a common constantly rotating parent. this is the code i am using:

 var brick : Transform;
 
 private var curObj : Transform;
 
 function Start () {
                 while (true)
                     { 
                     if (!curObj || (curObj.position.y==6.5 && curObj.position.z>0))
                         {               
                         curObj = Instantiate(brick, Vector3 (0, 0, 10), Quaternion.identity);
                         curObj.transform.parent = transform;
                         print(curObj.position.y);
                         }
                     yield;
                     }
                     }

the first object is spawned but the next one never spawns because the position of the spawned object never changes (maybe because it is a child of another object)...

please help me fix this.

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

2 Replies

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

Answer by Sonaten · Nov 06, 2012 at 12:37 PM

You haven't really answered your own question. So I think I will. The values that you see in the inspector are according to the current coordinate system.

Thus a child, with a rotating parent, does not change position or rotation, as the current coordinate system springs from the parent. You would have to do some 'from object to world' coordinate transformations and print the values to see the result you were looking for.

You current solution is based on a time delay, but you could also check the eulerAngles of the parent object.

 parent.transform.eulerAngles = new Vector3(some, different, values);

and spawn a child whenever a value or more reaches som arbitrary value.

I hope you could use this for something.

P.S. :P it's not very good conduct to mark your own answer as the solution.

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 zico_mahilary · Nov 06, 2012 at 12:38 PM 0
Share

thanks man this will definitely come to use...

avatar image
0

Answer by zico_mahilary · Nov 06, 2012 at 11:16 AM

nevermind... i just used yield wait for seconds....

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

10 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

Related Questions

How to open and close a door parented to a rotating object? 0 Answers

Why is it moving locally instead of globally? 1 Answer

Get child position in world space 4 Answers

Joints localPosition 0 Answers

Find Child's Position Relative To World (Global Position) 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