PlayMaker Help & Tips > PlayMaker Help

Getting Screen Point from a multiple camera scene

(1/2) > >>

mweyna:
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?

jeanfabre:
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

mweyna:
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 -



Then on the FSM on the GUI Element, I have



Additionally, on my 3d Game Object I have the following FSM set up -



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?

mweyna:
The end goal is to have something like this -



Where you have a tappable button on top of the 3d object.

jeanfabre:
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

Navigation

[0] Message Index

[#] Next page

Go to full version