Another quaternion demo

I’ll claim that I was distracted by watching Mr Bean at the same time and that’s why it took me so long. The ending is worth watching, I think, so skip to that if you get bored.

@Andrew_Stacey - Awesome :open_mouth:

I have some idea how much work this would have been (for me, anyway). How did you avoid colliding the blocks at the end?

I didn’t. If they don’t collide then it’s by chance. The cube “explodes” in that all cubes move to about three times their distance from the centre, then they all rotate to their relative correct places, and lastly collapse back in. No effort is made to ensure that they take distinct trajectories.

I now have it so that I can handle arbitrary cube sizes. It can get up to about 20x20x20 before getting unbearably slow.

@Andrew_stacey this is in the moderation forum, it’s a cool project I’d move it to general.

@Briarfox Thanks for noticing! That was dumb of me.

Here’s another video

@Andrew_Stacey wow, that is cool. How accurate are the touch sweeps to rotate a section of the rubix cube? The end effect is great too, you should make an app out of it!

@Luatee. Not sure what you mean. It can tell which cube and which face you touch and which direction you sweep in, then there are only two possibilities for which way the rotation should go so it just chooses the best choice. If the sweep doesn’t go very far then it doesn’t rotate.

Not sure if an app would be legal!

Incidentally, the second video was inspired by some posters that are up round my university for the national championships to be held in a couple of weeks’ time.

I meant is it accurate converting the 2D touch movement in to 3D, I thought it was working on 2 possible movements from 3 different touch movements (hope that’s clear enough) but it’s only 2 touch movements. But you answered my question.

I’m sure it wouldn’t be completely subject to copyright if you spruced things up a bit uniquely, the variable number of blocks is great too, which could progress with levels. Shame if it can’t be done, I would like to have an app like this even if it cost money.

Rubix cube championships you say? :-?

Yes, it is accurate in converting the 2D touch movement to 3D. It uses the scheme that I’ve laid out at here. First we work out which face of which cube has been touched. Then we transform the touch data so that it lies in the plane of that face and use that to work out which direction to spin.

The point is that by touching a particular face you are already declaring which two directions are possible to rotate. Then it’s just a matter of selecting the right one.

@Andrew_Stacey: Nicely done!

Useful stuff, thank you. I see, it isn’t all that hard to gather the information for 3D space you need.

@andrew_stacey i couldnt see the video because my safari is buggy. now it worked: great job!

Nice work Andrew Stacey!! I bet solving the second one will take quite a lot of time…

Wow, how many hours did it take you to do that? The end was amazing!

Very nice!

@MrScience101 Not long. I already had most of the pieces: I’ve been drawing cube meshes since we had meshes in Codea (witness the Roller Coaster) and 3D shapes since even earlier than that, the quaternions were what I was working on with Ignatz recently, I worked out the touch technology a while ago, and the rest is just assembling the bits.

@Andrew_Stacey very nice work !