Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Kirdissir14 on June 03, 2015, 12:35:58 PM

Title: GUI that follows a GameObject
Post by: Kirdissir14 on June 03, 2015, 12:35:58 PM
Hello everyone,

I have been struggling for quite a few hours now to achieve the following: I want a UI (Panel, Text and some Buttons for example) to follow a gameobject. The Size of this UI element should always stay the same, even when zooming in or out. Therefore I think this can't be solved with a world space canvas.

Cities Skylines is a perfect example for what i want to to. I found a clip which demonstrates this case:
I can't figure out where to start with this problem. Any advice maybe?

Thank you in advance
Title: Re: GUI that follows a GameObject
Post by: Kirdissir14 on June 05, 2015, 06:37:15 AM
*Bump*

has anyone an idea at all? Is there a way to positiom Camvases in screen space overlay?
Title: Re: GUI that follows a GameObject
Post by: jeanfabre on June 05, 2015, 07:13:10 AM
Hi,


 The Ecosystem has a Sample (http://hutonggames.com/playmakerforum/index.php?topic=9582.msg45480#msg45480) that demonstrate this:

(http://i.snag.gy/xdYIF.jpg)

Bye,

 Jean
Title: Re: GUI that follows a GameObject
Post by: Kirdissir14 on June 06, 2015, 05:01:44 AM
Hello Jean,

thank you so very much for your help! My idea was quite close to yours, but I don't know why I didn't work out. I still have a strange offset of the Panel but I could fix it with Vector3 Add.

Thank you for this awesome support!
Title: Re: GUI that follows a GameObject
Post by: jeanfabre on July 16, 2015, 09:57:11 AM
Hi,

 it's likely your rect transform set up that is not exactly right, it's difficult to get this when you start with it, so keep playing around with the new UI rect transform, it will make sense once you have experience with it. Make sure you watch as much tut on the new UI it helps.


Bye,

 Jean
Title: Re: GUI that follows a GameObject
Post by: gearedgeek on May 21, 2017, 09:29:37 PM
I know this is a old topic but I feel there is no need to start a new when my question deals with this topic.

I noticed that when you turn 180 degree from the gameobject the text is still visible. Is there a way to fix this?

Looking at object
https://postimg.org/image/c5bw1himn/

Looking away from object
https://postimg.org/image/5dlgymtn3/

Title: Re: GUI that follows a GameObject
Post by: jeanfabre on May 23, 2017, 02:29:57 AM
Hi,

 yes, you are correct, you need to account for the case that the GameObject being following is within the camera view frustrum or not. Use "GameObjectIsVisible" action for this.

 but watch out, in editor, if the gameobject is visible in the scene view it will stay true... it's not just about the gameview ( slightly odd... but once you know about this is ok)

Bye,

 Jean

Title: Re: GUI that follows a GameObject
Post by: gearedgeek on May 23, 2017, 09:28:48 AM
Thank you for the info. I didn't think about of using the "GameObjectIsVisible" action. I got it working.