How can i make a crosshair that moves depending or where the gun is pointing?

Is it possible to move the crosshair using ray casting so the player knows exactly where the gun will hit? My camera moves differently than the gun (its a turret) so it is usually hard to tell.

GameObject redDot;
RaycastHit hit;

void Update()
{
redDot.transform.position = hit.point;
}

Like that?

Yes, this is possible using ray casting. You would need to cast the ray from the tip of the barrel and use the turret’s facing direction as the direction for the ray.

Make sure to pass in a RaycastHit object when doing the ray cast so you know where your ray has hit something in your scene. You would then move your corsshair to the new hit position.

If you implemented your crosshair so that it is 2D, you could use the WorldToScreen or WorldToViewport functions to convert the 3D position so that it is in either screen space, or viewport space. You would then use those coordinates to place your corsshair correctly.