Raycast always hit a point at bottom left corner
Hi all,
I'm struggling to make a raycast hit a target that I previously moved at a speciific point. Here's my code :
 Ray camRay = m_camera.ScreenPointToRay( m_spherePosition.position );
             RaycastHit hit;
 
         //We make it move
         MoveStoneTarget();
 
         //We display the sphere and set its position to the hit point
         if( Physics.Raycast(camRay, out hit, 100f, m_stoneLayer ))
         {
             Debug.DrawLine( m_camera.transform.position, m_spherePosition.position, Color.red );
             Debug.Log( "What raycast hits " + hit.point + " " + hit.collider.name);
             Debug.Log( "My target " + m_spherePosition.position );
 
             m_sphereStone.SetActive( true );
             //m_sphereStone.transform.position = hit.point + Vector3.up * 0.1f;
         }
 
               If I'm commenting the last line, here's what I get : 
 But if I'm leaving it, this is what I get : 
In the first screenshot, my raycast hits at the bottom left of the screen, and I don't understand why. In the second screenshot, obviously, my target is moving to this mystery point.
So my question is : - What is this bottom left point ? - Why my "hit.point" is stuck there ? - And what can I do in order to make that Raycast hit my target ?
Can someone help me on this one ? Thanks
I found this issue that seems to be related to $$anonymous$$e, but it didn't help https://forum.unity.com/threads/solved-position-crosshair-with-raycast.505672/
Your answer