It would be great to be able to convert a world coordinate into a relative screen position in javascript.

There is a user:ProjectPositionToScreen(vector) function in lua, but using it in lua means that we would need to pass the data into a JSModel whenever we want to update the widget. So every update needs to pass and convert the data from lua to C++ to js over and over again. Having a Crayta.convertToScreenPosition(obj) function in js would allow passing the data only once for a given set of coordinates.

Another huge benefit of this idea would be, that this functionality would allow using screen widgets as debug tools/visualizers in edit mode since user:ProjectPositionToScreen(vec) is not available while simulating entities (since there is no user entity that could be referenced).

To sum it up, since ProjectToScreenPosition is only used for widgets, i think it makes sense and would be a improvement to add a JavaScript function for it.

Would really appreciate this feature a lot.

1 Like