Attention | Topic was automatically imported from the old Question2Answer platform. | |
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)
print(ray_cast)
How to do it ? The screen size may change.
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