Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: holyfingers on October 13, 2015, 10:06:41 AM

Title: Set Game Object as Viewport label...
Post by: holyfingers on October 13, 2015, 10:06:41 AM
Hi there,

I've been re-visiting some of my UI elements this week and thought I'd share my Game Object Label action. It works in a similar fashion to a GUI Label only it uses Game Objects, handy if you're making 3d interface elements, in-scene UI etc.

(http://i.imgur.com/zx2yARi.gif)

It takes the world-space position of a target-object and gets the viewport position, then positions a label object at that point at the corresponding world-space including optional offsets.

I've also including some limited functionality from http://wiki.unity3d.com/index.php?title=CameraFacingBillboard#Alternative_Mod so you can have the label align itself with your chosen camera.

Apologies if this already exists somewhere, I'd previously been using 4 or 5 separate actions and a script to achieve the same result and thought this was a bit tidier!

Let me know if you have any problems or spot any mistakes!

Cheers,

Nick 
Title: Re: Set Game Object as Viewport label...
Post by: dblincoeii on January 05, 2018, 08:35:18 PM
Hi Holyfingers.  I just found this playmaker action.  Looks like what I am needing but I cant seem to get it to do what I need it to.  I have a camera with a canvas and I want text on the canvas to follow the 3d objects screen pos.  Is that what this does?  How should I arrange the objects in my hierachy.  I'm assuming I use ui text.

Any help would be appreciated.  Thanks.
Title: Re: Set Game Object as Viewport label...
Post by: holyfingers on January 06, 2018, 08:53:29 AM
Hey there,

It's been a long time since I looked at this action but it was more for using 3d objects as a sort of pseudo-GUI, so not not really what you're after I don't think?

I had a quick check in Unity though and Playmaker has actions for converting back and forth between screen and world space, and has actions for Rect transforms...

(https://i.imgur.com/9SSl4El.png)

Scene here has a canvas set to Screen Space - Camera, a sphere and a UI text component, when I move the sphere about the text follows. There are loads of Rect Transform actions for setting offsets on the pivot etc as well...

Hope that helps!

Cheers,

Nick
Title: Re: Set Game Object as Viewport label...
Post by: ivabibliocad on September 16, 2018, 02:10:08 AM
Followed your template with no succees. Where did you get "sphere world pos" is that a variable? I created one and didn't work....
Where did you get the "rect transform to local" action?
Title: Re: Set Game Object as Viewport label...
Post by: djaydino on September 16, 2018, 02:29:00 AM
Hi.
Many Custom actions can be found on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181).
Title: Re: Set Game Object as Viewport label...
Post by: holyfingers on September 16, 2018, 06:02:58 AM
Followed your template with no succees. Where did you get "sphere world pos" is that a variable? I created one and didn't work....
Where did you get the "rect transform to local" action?

Hey, yes Sphere World Pos is a Vector3 variable, it's being set by the Get Position action there at the top.

As Djaydino says above, you can grab custom actions on the Ecosystem or they're on Github here: https://github.com/jeanfabre/PlayMaker--Unity--UI/tree/master/Assets/PlayMaker%20Custom%20Actions/RectTransform

Cheers,

Nick
Title: Re: Set Game Object as Viewport label...
Post by: ivabibliocad on September 17, 2018, 12:07:03 PM
Thanks man! I tested it with a vector 3  variable and works great!!!
Title: Re: Set Game Object as Viewport label...
Post by: craigz on March 26, 2020, 03:01:25 AM
Just wanted to hop in here real quick and mention this action isn't popping up on the latest version of Ecosystem 🤷‍♂️