0 votes

Hi
I'm wondering how I could acces the input of the mouse in visual script, for instance in order to move the caracter as I move the mouse... any idea ?

Thank you

asked Mar 13, 2018 in Engine by Nico_fr (50 points)
edited Mar 13, 2018 by Nico_fr

2 Answers

+1 vote
Best answer

Are you trying to get the mouse coordinates?

get_global_mouse_position() and get_local_mouse_position() are both methods of CanvasItem, so if you're using a 2D node, you can use "CallSelf" and call one of those functions.

Otherwise, your best bet is to add mouse click action(s) to the Input Map, and use the Input.is_action_pressed() function. You can get this from EngineSingleton -> CallInstance.

answered Mar 13, 2018 by kidscancode (17,704 points)
selected Mar 13, 2018 by Nico_fr
0 votes

Thank you for your great answer "Kidscan code" and thank you also for your tutorial videos :)
may be you also know the answer of this larger question : is there a full list of all visual-scripting nodes available, and their equivalent GDscript instruction ?.
and thanks again.

answered Mar 13, 2018 by Nico_fr (50 points)

There's a full list of nodes in the API docs:
http://docs.godotengine.org/en/latest/classes/index.html

They're not really separated out. Honestly, VS is still very new so there hasn't been much time for the community to contribute much in the way of documentation. I started to do some work with it, but honestly, I find it far more frustrating and cumbersome to use than GDScript, so I'm not really recommending it to my students.

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.