How to make a MOBA game control?

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

I want to do the controls like in Dota. There, when you click on any terrain, a point appears where the character needs to go. How to make this system? I am trying to do this with rays but cannot find the end position:

var space_state = get_world().direct_space_state
if Input.is_action_pressed("LefftClick"):
		_to_ray_cast = translation
		_to_ray_cast.y -= 15
		ray_cast = space_state.intersect_ray(
			translation, _to_ray_cast)

How to do it ? The screen size may change.
enter image description here

Example. I hover over the red dot and click. I need the exact cardinals in the world where I clicked. There’s a wall next to these coordinates

Sounds like what you’re trying to do is something akin to the controls in a real-time strategy game. The best I could find was designing an RTS tutorial. It may be a bit old, but it could also help you to get on the right track.

Ertain | 2021-05-20 00:39

:bust_in_silhouette: Reply From: ramazan

Connect the signal.
_on_StaticBody_input_event(camera, event, click_position, click_normal, shape_idx):
$Node.transform.origin = click_position