Logic nodes button

I am trying to find a way using logic nodes to create a button that on a PC would trigger with a mouse click and on mobile with a finger press - I have a polygon button for this but can’t find the right node to accomplish it.

Thanks for any help,

Brian

Hello Brian,

On Mouse and Mouse Coords nodes should also work on mobile. For special touch handling there is On Surace node, which in the future will allow to query multiple fingers for multi-touch controls.

For example - this node setup will fire an action when mouse is clicked, display is touched or gamepad button is pressed.

You can then use Coords nodes to retrieve input position.

If you are trying to implement a clickable UI button, then it should also get quite easy soon. I am working on a tool for Armory where you can define UI elements, and interacting with these elements will then fire events which can be handled easily with a single node.

Thanks Lubos,

This is what I was looking for “I am working on a tool for Armory where you can define UI elements, and interacting with these elements will then fire events which can be handled easily with a single node.”

I want to texture a plane with a button then use it as an in-game button. Please let me know when it’s implememted :wink:

Brian

I tried to get the name of an object that I click on it but I couldn’t find a way to do this. I tried to use ‘Cast Physics Ray’ node but I think I’m missing something.

Is the virtual button implemented yet, if so, how is it used?

There are already some examples:
UI Script 2D shows ho to make a 2D head up display style user interface
UI Script 3D shows how to render the GUI on a texture and capture mouse events on it
Game Bowling contains a working Us Interface, too
You can find the UI editor here (create a new canvas and hit ‘edit’)


ArmorUI then opens and you can define your event ID here:

You can catch this event ID with a ‘Event’ or ‘Global Event’ node in your logic tree.

4 Likes

You can drop Image into the Canvas too and use it as a button ,like donalffons explain here the same just define the event for the picture and scale it how u want.