Can I get the coordinates by mouse click?

I try to get the coordinates when I click by mouse on the field (not on the object, I know how to get the coordinates of the object). I would like that in Game Play mode the user can click by mouse and the programm get the coordinates of this click. Can I do this?

Yes, there is an appropriate code in TypeScript (and Python) for this:

Time.scheduleRepeating(() =>{
const rayCastHit = RayCast.cast( Camera.transform.position , Input.clickDirection );
if (rayCastHit && == “ground”){
camera.transform.position = rayCastHit.point},“right_mouse_button”);
if (rayCastHit) {xtext.text = camera.transform.position.x, ytext.text = camera.transform.position.y }

In this case I use the right mouse click instead of the left mouse click because by using the later it’s getting too messy, and you can’t move around. And I use the camera.transform.position to get the numbers more steady. Otherwise, the numbers change all the time by moving the mouse. But you can use:
//xtext.text = rayCastHit.point.x, ytext.text = rayCastHit.point.y,ztext.text = rayCastHit.point.z

Example: JRZ-BDC