I am developing a third person shooter. I have a player with a weapon. The weapon at the end of the barrel has a point, that makes ray casting forward at a given length. Also in the project there is a 2D screen on which a picture of the crosshair is installed. I tried to set the crosshair on the screen using the
.worldToScreen() method, but I did not succeed. Crosshair is installed in the wrong place. Tell me, please, how to correctly make the installation of a crosshair on the screen, based on the device screen size and coordinates of the end of the ray, which ray cast provides?