Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: HazardousInteractive on April 30, 2014, 09:57:40 PM

Title: NGUI in 3D coordinates
Post by: HazardousInteractive on April 30, 2014, 09:57:40 PM
hello,

How can I make a GUI that hovers over a character to say to show its name/health etc... And gets smaller when the player goes farther or closer, and always faces the player
Title: Re: NGUI in 3D coordinates
Post by: ArenMook on May 01, 2014, 07:36:21 AM
If you are doing it in 2D, then you need to write a script that will scale the game object containing your healthbar based on the distance from the camera to the object the health bar is following.
Title: Re: NGUI in 3D coordinates
Post by: HazardousInteractive on May 01, 2014, 09:23:23 AM
If you are doing it in 2D, then you need to write a script that will scale the game object containing your healthbar based on the distance from the camera to the object the health bar is following.
And how can I make it be above the character?
Title: Re: NGUI in 3D coordinates
Post by: Yukichu on May 01, 2014, 09:42:16 AM
Adjust the Y coordinate relative to the player (or Z, or X, or whatever depending on your setup), either before or after you transform the position from world to camera or whatever.
Title: Re: NGUI in 3D coordinates
Post by: ArenMook on May 02, 2014, 08:11:56 AM
I generally just have a child game object of the 3D object that's offset to be above the 3D object. I target this child object instead of the 3D object, resulting in the 2D UI being offset automatically.