GetScreenCoord() from the PDK help

virtuali
Posts: 188
Joined: Tue Sep 27, 2011 12:51 pm

GetScreenCoord() from the PDK help

Postby virtuali » Wed Dec 21, 2016 11:19 pm

Hello,

I would like to have some hints how to use the GetScreenCoord() from the PDK API, since the documentation is not very clear and there's no sample that use this function.

From what I gather, it might be used to transform a set of coordinates in the 3d world in screen coordinates, however, it's usage is not very clear. I was able to write some code, and it works fine, no errors, and the call returns data that as expected, change according to the camera viewpoint, but I don't fully understand how they are supposed to be used.

I used the 2nd variant of the function, that takes only a list of offsets and returns a list of screencoordinates and, according to the documentation, it's supposed to

"Get the screen space coordinates of a list of points relative to user sim object"

- What kind of coordinates the returned values represent ? Offset in meters ? Or something else ? Do they have to be transformed in some way ?

- Why the coordinates are returned as set of 3, aren't they supposed to be "screen" coordinates, hence 2d ? The 3rd z value it's usually from -1 to 1...the documentation is a bit confusing, since the returned parameter is explained as:

Code: Select all

void GetScreenCoord   ( const float xyzOffset[][3], float xyOutput[][3], const int count ) const


the xyOutput name suggest they should be two numbers, then why the prototype indicate a multi-dimensional array of 3 ?

I think this part of the SDK could use a bit more explanations, or samples.
Umberto Colapicchioni - VIRTUALI Sagl
http://www.fsdreamteam.com

virtuali
Posts: 188
Joined: Tue Sep 27, 2011 12:51 pm

Re: GetScreenCoord() from the PDK help

Postby virtuali » Thu Dec 22, 2016 10:40 am

Hello,

I think I figured it out...it works fine, it remains the small "mistery" of the 3rd returned coordinate, which seems to be always 1, but I guess I might just ignore it.
Umberto Colapicchioni - VIRTUALI Sagl
http://www.fsdreamteam.com


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 2 guests