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
0
Question by jaapkok · Dec 01, 2014 at 02:30 PM · gameobjectparentpivot

Make rotation gameobjects equal to parent

Hi,

I've scripted a amount of GameObjects that are linked to a parent. When I move around in the parent GameObject, the position of the gameobjects change too. There are textMeshes added to the GameObjects. But when I rotate it, The gameobject won't rotate and don't use the parent as a pivot.

How can I fix this problem. I've tried several approaches on Unity Answers, but they only rotate the textMeshes seperatly separately.

So what I want to do is Animate from a begin position to a target position. But when I do that, the rotation isn't correct anymore:

 gameobject.transform.position = position = Vector3.MoveTowards (gameobject.transform.position, targetPosition, step);

 private  GameObject createLetter(string l, Vector3 position)
     {    
         GameObject myTextObject = new GameObject("fontPosition/"+l);
 
         myTextObject.transform.parent = fontPosition.transform;
         //myTextObject.transform.RotateAround(fontPosition.transform.position, new Vector3(0, 1, 0), 90);
 
 
         //float angle = Mathf.Atan2(fontPosition.transform.position.y, fontPosition.transform.position.x) * Mathf.Rad2Deg;
         //myTextObject.transform.rotation = Quaternion.AngleAxis (120.0f, fontPosition.transform.position);
         //fontPosition.transform.RotateAround (new Vector3 (1, 0, 1), fontPosition.transform.position, 90.0f);
 
 
         myTextObject.AddComponent<TextMesh>();
         TextMesh textMeshComponent = myTextObject.GetComponent(typeof(TextMesh)) as TextMesh;
         MeshRenderer meshRendererComponent = myTextObject.GetComponent(typeof(MeshRenderer)) as MeshRenderer;
         
         meshRendererComponent.material = (Material)Resources.Load( "Materials/fontMaterial");;
         meshRendererComponent.material.color = Color.white;
 
         textMeshComponent.font = SantasSleighFont;
         textMeshComponent.text = l;
     
         textMeshComponent.color = Color.white;
 
             return myTextObject;
     
     }
Comment
Add comment · Show 2
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 SaraCecilia · Dec 01, 2014 at 04:28 PM 0
Share

Try through the inspector? http://answers.unity3d.com/questions/18637/change-pivot-of-parent-game-object.html

avatar image Baste · Dec 01, 2014 at 04:37 PM 0
Share

Edited: fixed a typo. Took me a while to understand that you were talking about text$$anonymous$$eshes, not 'test$$anonymous$$eshes'.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by jaapkok · Dec 02, 2014 at 11:44 AM

Thanks, I think ive solved my problems by using both position and localPosition. When I move the particles from a begin position I use localPosition to move the particles form begin to end position. I've parented the textMesh instead of the complete gameObject

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

change pivot of parent game object 1 Answer

"Center On Children" programmatically 1 Answer

Fixing pivot points with second gameObject workaround 1 Answer

How to be sure that the parent's position is the same is the child's position? 0 Answers

Objects are destroyed/disfunctional after changing scene 3 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