Rubicks Cube

Forums Nodes, Macros & Examples Rubicks Cube

This topic contains 3 replies, has 2 voices, and was last updated by  Gavalakis 3 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1068

    westray
    Participant

    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.

    Attachments:
    You must be logged in to view attached files.
    #1072

    Gavalakis
    Keymaster

    Hey,

    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?

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

    #1073

    westray
    Participant

    Yes,I also have it working on my android phone. How could I rotate the whole cube on that and the face in the opposite direction?

    #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:
    You must be logged in to view attached files.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.