Reply To: Rubicks Cube

FlowCanvas Forums Nodes, Macros & Examples Rubicks Cube Reply To: Rubicks Cube

#1074
Gavalakis
Keymaster

Hey,

In this case I suggest that you use the ‘UI Pointer’ event node which works with the Unity Event System and which can also be used to catch mouse events on colliders (not only for UI).

You will first need to set up the system:
– Create Event System through Unity top menu “GameObject/UI/EventSystem”.
– Attach “Physics Raycaster” component to your camera. (this is needed for the system to work with colliders).

Now in FlowCanvas, you can use UI Pointer event. The ‘Event Data’ output is a class that contains information about the event. Here is a link to Unity script reference if you want to take a look: [PointerEventData]

What I did here is use that output and store the “button” property as a variable. The button property is an Enum that tell us which button was pressed. It can be Left, Right or Middle.
UI-Pointer

Later in your flowScript, I use Switch Enum node, to switch the previously stored InputButton variable and rotate the object clock or anti-clock wise.
SwitchEnum

Let me know if this helps you, or if you need any clarification.
Thanks!

Join us on Discord: https://discord.gg/97q2Rjh

Attachments:
  1. UI-Pointer.png

  2. SwitchEnum.png