Unity - Find a point for a gameobject to look at the mouse while camera is at any angle
<p>I have a 3D game where I want an arrow to point in the direction base on the mouses angle of that object in a 2D view.</p>

<p>Now from the camera looking down at the board from a 90 degree x-angle standpoint it works fine.  The below image is when I am in a 90 Degree x-angle Camera angle facing down on my game and I have the arrow face where my cursor is:</p>

<p><a href="https://i.stack.imgur.com/GQ5NG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GQ5NG.png" alt="enter image description here"></a></p>

<p>But now when we take a step back and have the camera at a 45 degree x-angle the direction the arrow is facing is a bit off.  The below image is when I have the cursor face my mouse cursor when my camera is on a 45 degree x-angle :</p>

<p><a href="https://i.stack.imgur.com/bQVXT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bQVXT.png" alt="enter image description here"></a></p>

<p>Now lets look at the above image but when the Camera is shifted back to 90 Degrees x-angle:</p>

<p><a href="https://i.stack.imgur.com/oZNb1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oZNb1.png" alt="enter image description here"></a></p>

<p>My current code is:</p>

<pre><code>        // Get the vectors of the 2 points, the pivot point which is the ball start and the position of the mouse.
        Vector2 objectPoint = Camera.main.WorldToScreenPoint(_arrowTransform.position);
        Vector2 mousePoint = (Vector2)Input.mousePosition;
        float angle = Mathf.Atan2( mousePoint.y - objectPoint.y, mousePoint.x - objectPoint.x ) * 180 / Mathf.PI;
        _arrowTransform.rotation = Quaternion.AngleAxis(-angle, Vector2.up) * Quaternion.Euler(90f, 0f, 0f);
</code></pre>

<p>What would I have to add in my Mathf.Atan2() to compensate for the camera rotation on the x and/or y to make sure when the user wants to move the camera how they please it will make sure to provide an accurate direction?</p>

<p>EDIT : The solution was in MotoSV's answer with using Plane.  This allowed me to get the exact point no matter what my camera angles were based on my mouse position. Code that worked for me is below :</p>

<pre><code>    void Update()
    {
        Plane groundPlane = new Plane(Vector3.up, new Vector3(_arrowTransform.position.x, _arrowTransform.position.y, _arrowTransform.position.z));
        Ray ray = _mainCamera.ScreenPointToRay(Input.mousePosition);
        float distance;
        if (groundPlane.Raycast(ray, out distance))
        {
            Vector3 point = ray.GetPoint(distance);
            _arrowTransform.LookAt(point);
        }
     }
</code></pre>