Get mouse translation in 3D space

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By blank

The setting is Isometric perspective 3D scene with orthogonal static(not following the player) camera, using a gridmap with mesh shapes for the terrain.

What I’m trying to achieve here is get the mouse position on the terrain when clicked to be able to send a projectile in the direction of mouse pointer, which I was able to do by connecting the _input_event() signal of each meshinstance in said gridmap to player body which is painfully stupid process, and doesn’t work if clicked outside of said gridmap.
And the other thing is to rotate player character towards the mouse cursor at all times which I tried setting up screen raycast as stated in documentation, but couldn’t get it to work right.

Anyone can help me on this and spare me any more headache please?

:bust_in_silhouette: Reply From: blank

Found a solution:

Created an invisible plane mesh over the whole world with higher Y axis than everything else, and used intersect_ray() function to intersect the camera raycast with it, then used the x and z translation of this raycast vector and player y translation to get a directional vector3() for rotation and projectiles.