I
I
i__egor2022-02-22 07:14:57
Unity
i__egor, 2022-02-22 07:14:57

How to convert world position to screen position in world unit?

I have a canvas screen space camera. I need to display the ui over the coordinates in the world so that it is in the canvas in the panel.
This is how it doesn't work:

Vector3 screen_pos = cam.WorldToViewportPoint(pos_world);
this.transform.position = screen_pos;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2022-02-22
@freeExec

Because you wrote stupidity, you converted it to "let's say so in screen" and for some reason put it back into world coordinates.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question