Hello. I started doing a space shooter. I have a problem with the player ship’s sight. I mean controlling the ship from a third person perspective. I want the camera crosshair to appear on the screen, as well as the player ship’s crosshair to point to where the player’s ship is pointing. I mean a fairly common effect seen, for example, in the game “World of Warplanes”. I have no problem with the camera crosshair. I have a problem with the player ship’s crosshair. I am using this code to set the crosshair for a ship:
Camera camship = GameObject.Find("CameraShip").GetComponent<Camera>();
ShipAim.transform.position = camship.WorldToScreenPoint(this.transform.forward * 1000);
However, for some reason the player’s crosshair completely slips off the canvas with randomly changing positions. Does anyone have an idea what is wrong? I have tried several ways to solve this problem, but the effect has always been the same. I am asking for help and possible explanation if anyone knows the source of the problem