A fully interactive 3D Rubik's Cube simulation built using .NET and OpenGL. This project demonstrates 3D rendering, matrix transformations, and user input handling to simulate the mechanics of a real Rubik's Cube.
This application allows users to interact with a virtual Rubik's Cube. It features full 3D rotation, individual layer manipulation, and a shuffling mechanism. It is designed to demonstrate graphical programming concepts using the OpenGL standard within the .NET ecosystem.
- Real-time 3D Rendering: Smooth OpenGL graphics.
- Free Camera: Rotate around the cube to view it from any angle.
- Layer Control: Independent control over X, Y, and Z axes.
- Shuffle Mechanic: Instantly randomize the cube state.
Use these keys to rotate the view or move the selection.
| Key | Action |
|---|---|
| Arrow Keys | 🔄 Rotate Camera (Orbit view) |
| W | ⬆️ Move Up |
| A | ⬅️ Move Left |
| S | ⬇️ Move Down |
| D | ➡️ Move Right |
| R | 🔀 Shuffle / Randomize Cube |
Control specific layers of the cube using the keyboard.
| Key | Layer / Direction |
|---|---|
| Z | Move Axis X (Negative) |
| X | Move Axis X (Positive) |
| C | Move Axis X (Center) |
| Key | Layer / Direction |
|---|---|
| U | Move Axis Y (Negative) |
| I | Move Axis Y (Positive) |
| O | Move Axis Y (Center) |
| J | Move Axis Y Backwards (Negative) |
| K | Move Axis Y Backwards (Positive) |
| L | Move Axis Y Backwards (Center) |
| Key | Layer / Direction |
|---|---|
| 1 | Move Axis Z (Layer 1) |
| 2 | Move Axis Z (Layer 2) |
| 3 | Move Axis Z (Layer 3) |
| 4 | Move Axis Z Backwards (Layer 4) |
| 5 | Move Axis Z Backwards (Layer 5) |
| 6 | Move Axis Z Backwards (Layer 6) |
- .NET SDK (Version 6.0 or higher recommended).
- Graphics Card: Must support OpenGL.
- IDE (Optional): JetBrains Rider or Visual Studio.
You can run the simulation either via the command line or by using an IDE.
If you just want to run the app without opening an editor:
-
Clone the Repository
git clone https://github.com/levilevente/Rubik-s-cube-simulation.git
-
Navigate to the Project Folder
cd Rubik-s-cube-simulation -
Run the Application
dotnet run
If you want to inspect the code or debug:
-
Open the Project
- Launch JetBrains Rider (or Visual Studio).
- Select Open and select the
.sln(Solution) file inside the cloned folder.
-
Run the Simulation
- Wait for the dependencies to restore.
- Click the green Play button in the top toolbar.