0 votes

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

Godot version 3.2
in Engine by (12 points)

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.

1 Answer

0 votes

Connect the signal.
onStaticBodyinputevent(camera, event, clickposition, clicknormal, shapeidx):
$Node.transform.origin = click

by (22 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.