Here is a small example of a Rubicks Cube I am working on.At the moment the middle mouse button rotates the cube and the left mouse button rotates a face anticlockwise when you click on it.How can I make it so a left or right mouse button click rotates a face in both directions?This package requires flowCanvas obviously,DOTween Pro and the DOTween Pro Extensions available in the downloads section.
That’s a very nice example you got here. Thanks a lot for sharing! 🙂
Are you asking how to make it so that the right click rotates the face the other way (clockwise), while the left click still rotate counter-clockwise as it currently is?
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.
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.
Let me know if this helps you, or if you need any clarification.