Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: mweyna on February 13, 2014, 11:26:56 AM
-
So I have two cameras in my scene, a UI 2d Camera, and a 3d Game Camera. I want to get the screen position from the 3d Camera, and feed that position data into an object under my NGUI 2d Camera. However, just using the normal Screen to World Point actions, it seems to just get the position data from the 2d Camera, so if I move my 3d camera around, the object remains in the same position (since the 2d Camera position technically hasn't changed). How should I approach this to get the right variables to the right FSMs?
-
Hi,
What are you trying to achieve? if you want a ngui element to follow a 3d object, you should use existing components and tools ( the ngui HUD has this in store).
bye,
Jean
-
So I tried NGUI HUD, and have a UIFollowTarget on my GUI element - However, I can't seem to find a way to assign the Target property dynamically. See image -
(http://s28.postimg.org/duyc6h4p9/Issue01.png)
Then on the FSM on the GUI Element, I have
(http://s28.postimg.org/rh3ncrbpp/Issue01.png)
Additionally, on my 3d Game Object I have the following FSM set up -
(http://s27.postimg.org/6x8x8i8lf/Issue01.png)
However, it doesn't seem to assign that game object variable to the script appropriately.
Right now, at runtime, the object gets created at the center of the screen. Assigned properly under the HUDText layer in my 2d UI Camera. And then does nothing. What am I doing wrong?
-
The end goal is to have something like this -
(http://resource.supercheats.com/library/the-simpsons-tapped-out/IMG_3404.jpg)
Where you have a tappable button on top of the 3d object.
-
Hi,
I am confused, you seem to be mixing Unity GUI and NGUI? can you confirm?
using Unity GUI is very easy, the action GUILayoutAreayFollowObject works fine. do you have problems with this one in particular?
using UIFollow target: Assigning dynamically should simply be setting the "target". when I say simply.... since in PlayMaker you only can store GameObject, it's tricky but possible :)
http://hutonggames.com/playmakerforum/index.php?topic=6246.msg30566#msg30566
the link above will explain how to set a component "transform" property, and so you can apply this to work with UIFollow
bye,
Jean
-
Nope was trying to run this all through NGUI, not the built in Unity UI. So I tried the method you suggested in the other thread, having a global action that sets the GUILayout -
(http://s11.postimg.org/ap6uvdu9v/image.jpg)
(http://s10.postimg.org/qdxbnzxu1/image.jpg)
However, it doesn't seem to follow my object them either. What am I missing here? The Object the FSM is on is just a standard GUITexture UI Sprite (From default Unity, not NGUI) per your suggestion.
-
Hi,
you have nothing in your follow area, you begin the area and then you end it.put a button and see where it is.
bye,
Jean
-
How would I define a scene game object to the Prefab UIFollow Target Script?
The field wants a defined transform and direct links to the camera objects, but I don't see how to assign them with a Set Property action.
-
Yes trying sandwiching your begin and end area