So i’m just getting back into UE4 after about 2 years of not using it. so im VERY rusty and my knowledge of the engine is pretty much shot right now.
I’m trying to make a game where you play chess on the surfaces of a rubik’s cube. on your turn you can choose to either move a piece or turn a section of the cube. besides that it plays exactly like chess.
right now I have a cube BP class that has a cube static mesh. this represents one block on the rubik’s cube. Next I have a Rubik’s Cube Class that spawns these cubes in a position that would create a much larger cube of cubes (classic rubik’s cube shape) and stores them in an array as demonstrated below.
Here is where I get stuck and do not no how to proceed.
How can I rotate each row or column around a central axis similar to a rubik’s cube?
Each of the surfaces of each individual cube is space a game piece can move to. I will need to manipulate each individual surface to edit its material or get info if that space is occupied or not or determine connecting spaces. Would the best way to do that is create a space BP and spawn some with cube?
I want to be able to drag the mouse and the entire rubik’s cube rotate in the direction of the mouse so that the player can get a good view of the play field. I cant seem to make this work. any ideas?
Any help would be very appreciated!
I have made a ton of progress thanks to your guidance Everynone. I’m not going to say that I understand everything that you demonstrated to its full extent but i think i have a pretty good grasp on things.
I tried to follow your work as much as I could. I had to make a few changes here and there to fit with my project. I ran into a couple of bugs that i had to solve which is what has taken me so long to respond back to this thread. I wanted to try and solve the bugs myself before coming and asking for help.
So for the Results…
The following is my spawn cube function
And the next figures are my Cube Clicked:
LETS SEE IT IN ACTION!
As you see it turned out really good! even if it took me a couple of days to iron out all of the bugs. the best part about it is that i actually learned a lot from your example. it enlightened me on things i was confused about and introduced me to methods i didn’t know existed! I am very grateful for your help!
My next step in the project to allow the player to rotate the cube any direction to get better views of the cube. ill definitely update everyone on my progress as I go or if i have any further questions!
Once again! THANK YOU!
**EDIT #2: **
So I have made a lot of progress so far with this, but unfortunately I think I have run into something else i cant quite wrap my head around yet.
right now I am working on the pawns that you will move around the play area. the following is my temporary pawn Mr: Mustache:
As you can see below him is a collision box. I use this to get the overlapping cube that is underneath the pawn and attach the pawn to the cube so that when i rotate a selection of the cube it also rotates the pawn. so here is the results! https://i.gyazo.com/0d93cdbaaf1dee5d…38ca8c710b.gif
So thats looking pretty good. but the issue lies in if I start to customize the cube as demonstrated in the following gif: https://i.gyazo.com/542f96d48b1bc130…ee477a2a7e.gif
Obviously as shown in the gif I don’t want the pawn to be inside a cube after a rotation. I need the rotation of the selection to push the pawn around until the rotation stops and then the pawn will attach itself to the appropriate cube. I have yet to be successful making this happen.
So question 1 is How do i make the pawn rotate around with the selection if it collides with a cube in the selection.
My second question is about moving the pawn. i’ve done some research on tile based movement. but I cant make any examples fit my project. all other projects only take into account a 2d array of tiles which usually means only tiles on an X axis. but with my project i have tiles on the X, Y, Z A, B,C, D, etc axis’.
Not to mention that its entirely dynamic. each tile could change neighbors with any rotation of the cube.
My feeble mind cannot begin to comprehend how to begin making this work.
So to reiterate,
Question 1: How do i make the pawn rotate around with the selection if it collides with a cube in the selection.
Question 2: How do i handle the Dynamic 3 Dimensional Tile Based movement around this God forsaken cube?
Paging Everynone for his unlimited knowledge. you seem to know your way around a cube.