playMaker

Author Topic: World To Screen Point[SOLVED]  (Read 12298 times)

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
World To Screen Point[SOLVED]
« on: October 02, 2013, 05:17:40 PM »
Hi everyone,

World to screen point action doesnt behave how I expected.
I feed it with a (working)world  vector3 but it won't store any screen point / X / Y.
Am I doing anything wrong ? is it a bug ?

I am trying to check what is the position of a click on the screen.
So I  have a MousePick feed a hitPoint variable and then I input this variable into the World To Screen Point action which doesnt return any screen coordinate.
I am going to try with GetMouseX/Y to fix my issue, but I am still curious to know why I am having this issue.


Any help apreciated.
Thank you
Yaniv
« Last Edit: October 04, 2013, 01:28:00 AM by jeanfabre »
Visit my portfolio: http://www.yanivcahoua.com/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: World To Screen Point
« Reply #1 on: October 03, 2013, 02:10:08 AM »
Hi,

 Are you not mistaking between viewport and screen reference?

http://docs.unity3d.com/Documentation/ScriptReference/Camera.ViewportToWorldPoint.html
http://docs.unity3d.com/Documentation/ScriptReference/Camera.ScreenToViewportPoint.html
http://docs.unity3d.com/Documentation/ScriptReference/Camera.ScreenToWorldPoint.html

http://docs.unity3d.com/Documentation/ScriptReference/Camera.html

 If in there you find what you need let me know, and I'll guide you as to how to get this with playmaker. It's important that you first understand the difference betwen screen and viewport references.

Bye,

 Jean

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: World To Screen Point
« Reply #2 on: October 03, 2013, 03:34:59 PM »
Thank you Jean,

I learnt a thing or two in these docs, but my problem was that no value at all was stored, it stayed on 0,0. Maybe the setup of my FSM wasn't right.
Any way I moved on and find another solution.
Let's call it done for now...
Yaniv
Visit my portfolio: http://www.yanivcahoua.com/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: World To Screen Point
« Reply #3 on: October 04, 2013, 01:27:42 AM »
Hi,

 I see. you need ot first make sure you are storing variables properly indeed.

bye,

 Jean

deepcgi

  • Playmaker Newbie
  • *
  • Posts: 2
Re: World To Screen Point[SOLVED]
« Reply #4 on: October 17, 2013, 05:51:18 PM »
On a related problem...

When I am converting a world point, stored in a Vector3, to a screen point, the manual indicates that the screen point value should be stored in a Vector3 format even though in is only 2D.   The issue is that the World to Screen Action IS returning a non-zero value for Z.  Is the manual wrong and I should just disregard that non-zero value?

Perhaps this is why the action won't save the information in a Vector2 variable?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: World To Screen Point[SOLVED]
« Reply #5 on: October 21, 2013, 02:58:19 AM »
Hi,

It's fine, ignore the z value. The z value is the distance from the camera ( on the camera z axis)

http://docs.unity3d.com/Documentation/ScriptReference/Camera.html

bye,

 Jean