if (Physics.Raycast(ray, out hit))
targetPosition = hit.point;
Debug.Log(targetPosition);
In another, the targetPosition always gives me 0, 0, 0. I assume the raycast is hitting something - but I don’t see anything there. How do I find what is it hitting that I keep getting those results?
Look here… there is a lot of information provided back to you in that “hit” object.
You can get the collider, transform (transform.gameObject) , rigidBody attached… even the triangle mesh.
That should get you what you need.
You could add some debug.log prints, to show some of that information. Or put a breakpoint on that code and debug it to see what is in there.