I have the following scene below, I have a crosshair on my screen which is positioned on the canvas, what I would like to know is, is it possible to fire a projectile from a position on my player to the point of the crosshair?
I have been using raycasts originally and have a shooting system in place but was just curious what the best way to achieve this would be if possible?

If the crosshair is at the mouse position, use
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RayCast hit;
//Then use a raycast
if(Physics.Raycast(ray, out hit, mathf.infinity))
{
execute code
}
That is the most optimal way to do it. You can of course also just locate at what position the crosshair is in XY (Vector2). Then fire a ray from camera to that one instead.