Screen position gives wrong values

I wrote a basic code to get screen position of two world object entities and tried to set two divisions of HTML component on those positions on pressing the ‘O’ key.

I am getting close positions but they are always offset by some values. Can anyone take a look at what is wrong with my idea.

https://playcanvas.com/editor/scene/995472
scene Name: ‘Video Test’
code: PlayCanvas | HTML5 Game Engine

That is usually too much code for anyone to really look into. Make sure you use the device pixel ratio when using world to screen method. You can find an example here:
https://playcanvas.com/project/679740/overview/world-to-ui-screen-space

If this doesn’t work, please try to make a small project that answers the following question - what is the minimum example you can make that replicates your issue?

1 Like

I have added a few comments and the function ‘repositionVideoMarkers()’ is the one where I am getting the error.
I am unable to reduce it to smaller code, as most other functions either create the HTML DIV as I need them or change its visibility.

Please see ‘repositionVideoMarkers()’ as needed.