## Help : Rubics Cube Iphone

Nibbie
Posts: 3
Joined: 2009.06
Post: #1
Hi,

I will be developing an application for a Rubics cube Iphone game including a solver at a later point using a 3d graphical interface. i would like your opinion of which is the best software to use in order to complete this application. (the graphics) . I think the challenge will be to create a rotatable by touch 3d cube.
This is my first post so excuse me if i posted in the wrong forum.

Thank you
Moderator
Posts: 508
Joined: 2002.09
Post: #2
First, is it really worth it? There are already a number of Rubic's Cube apps on the iPhone, I use Cubix which is good enough for me.

If you really want to do it anyway, the graphics are very simple. Just make a 27 cubes, and add a color for each vertex. You can do this all in OpenGL ES, you don't need to use any other graphics program.

"When you dream, there are no rules..."
Nibbie
Posts: 3
Joined: 2009.06
Post: #3
Actually is a research project am undertaking. Will it be possible to rotate this cube using touch only control?
Nibbie
Posts: 3
Joined: 2009.06
Post: #4
Hi again,so any ideas on how is the best way to proceed?
Moderator
Posts: 428
Joined: 2002.09
Post: #5
Seems straightforward. 1. Detect when player has dragged their finger. 2. Project point of touch to see which cube they hit. 3. Compare the vector of the movement to vectors representing each of the directions the touched cube would move if rotated. For example, a corner cube can be pushed in 6 different directions (three different rotations, each going forward or backward.) 4. If the movement's vector is close enough to one of the cube's rotatons, then rotate the cube (and all the other ones in that layer) in that direction 90 degrees. 5. If the initial touch doesn't hit anything,

If you constrain the views of the cube instead of allowing arbitrary rotation, then the logic to interpret the player's touch could be written out explicitly. So instead of doing vector math like I suggest above, you might instead simply interpret a right-to-left horizontal swipe as rotation around the Y axis of whichever of the three X-Z layers they touched.

You will probably have to tune the motion controls, doubtful they'll feel right the very first time you implement them. Things to tune include sensitivity of the cube to small finger motions, and how far to rotate for a particular movement. Maybe instead of rotating 90 degrees each time, you could freely rotate the layer, and when the player lifts their finger, rotate the layer the shortest distance that will line it up with the rest of the cube. Etc.

Measure twice, cut once, curse three or four times.