Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: E1iTe on January 24, 2014, 12:07:25 PM
-
Hi all,
I know a bunch of people have asked about health bars, but I'm having trouble adding health bars at a objects feet like the game RAD Soldiers: (http://www.splashdamage.com/screens_radsoldiers/005_tb.jpg) I'm trying to get half circular bars bill boarding to the camera. Any help or links to someone that has done this already would be great. Thanks in advance!
-
If you want them to be in your world, add a UIPanel to a game object, then add a widget to it like you would if it was your UI. You can position the panel (or your widget) like you would any game object.
If you want them to be overlayed, then set up a 3D camera with the same camera angle as your main camera and set it to draw after the main camera. Place your widgets on the XZ plane (assuming the characters stand on XZ), and it should keep the same tilt visually. You will still want to position them correctly underneath your characters by using math.
-
If you want them to be in your world, add a UIPanel to a game object, then add a widget to it like you would if it was your UI. You can position the panel (or your widget) like you would any game object.
If you want them to be overlayed, then set up a 3D camera with the same camera angle as your main camera and set it to draw after the main camera. Place your widgets on the XZ plane (assuming the characters stand on XZ), and it should keep the same tilt visually. You will still want to position them correctly underneath your characters by using math.
Hey Aron, thanks for the answer but i'm still having issues with this.
I mean I took a cube, made an empty gameObject a child of the cube.Attached UIPanel Script to it, made a widget a child of this panel GO and placed a sprite as a child of this widget. What I now see is that the sprite gets ENLARGED.
Also I still didn't get what you meant by "add a UIPanel to a game object, then add a widget to it like you would if it was your UI. You can position the panel (or your widget) like you would any game object." Need more details in it. Thanks.
EDIT : Something like this?
(http://i.imgur.com/pFgP1ha.png)
-
Yes, sprite is going to be large. If it's a 20 pixels sprite, it will be 20 units after you add it. This is why UIRoot is scaled by 2 / Screen.height -- this is what keeps your sprites small on the screen. You need to scale your panel accordingly. Make it small.
Simple steps to adding in-game UI:
1. Create a game object on the layer of your choice, for example "Default".
2. Scale it to something small, like (0.01, 0.01, 0.01)
3. Add a child widget to it (ALT+SHIFT+S for example).