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 gardian06 · Apr 16, 2013 at 08:32 PM · parentingmovinggameobject

percentage bar parented to a moving rotating object

I am currently trying to create a percentage bar (health, completion, statPercentage). I found one implementation that uses 2 planes, and then re-sizes the more forward one, to have it look like a percentage meant for a 2D game where objects never rotate. but where if the objects used to display this percentage would be parented to an object that can rotate this causes problems, and beyond that the game takes place in a 3D space where any given face of the parent can be facing the camera, and be proxy this plane system would need to be adjusted.

I know that I could probably get away with this by using GUI, but I would much rather use the plane method so that is is not always on the topmost draw layer.

how could I implement this type of percentage bar system so that the percentage bar:

  • move with the object.

  • is always upright even when the object is rotated.

  • is always facing the camera.

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
0

Answer by AVividLight · Apr 16, 2013 at 10:00 PM

Hey Gardian06,

Maybe I'm misunderstanding your question, but could you parent the panes to the main camera?

If it's clear I don't understand, please let me know so I can modify my answer.

I hope this helps! -Gibson

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 gardian06 · Apr 17, 2013 at 02:10 PM 0
Share

but if these objects were created dynamically then a reference to each object would have to be given as needed.

avatar image
0

Answer by Dracorat · Apr 16, 2013 at 10:02 PM

What about:

 progressObject.LookAt(camera); 

... in each Update step.

??

To make it move with the object, just make it a child of the object.

Comment
Add comment · Show 2 · 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 gardian06 · Apr 17, 2013 at 02:08 PM 0
Share

Ok, it looks like that works for the orientation, but the issue I have with making it a child of the object is that the objects can also rotate freely about any axis meaning that the progressObject would orient itself with the parent, so I think my options are either to adjust orientation each frame (if they are children), or adjust position each frame (if they are independent)

though if they were independent then if these objects they were referencing were created dynamically they would also have to create their own progressObject to maintain reference.

avatar image Dracorat · Apr 17, 2013 at 03:22 PM 0
Share

Just make sure to orient the parent object first, then do the lookAt camera for the progress object. The easiest way is to get a reference to the progress object inside the update loop of the parent - move the parent, then "look" the progress - all inside the same update call.

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

12 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

Related Questions

Moving gameobject to Sibling's child ("Niece?").,Moving Gameobject into sibling's child ("Cousin?") c# 1 Answer

iTween moving all children the same way the parent object does 0 Answers

Manipulating Instanced Object 2 Answers

i want the camera stop follwing my player only on y axis when he jumps... 4 Answers

how to make an objects rotation independent from its parents. 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