PDA

View Full Version : Mel Script for Rubik's Cube????


moniharri
04-07-2008, 01:50 PM
Does anyone have a simple mel script to animate a rubik's cube?? I have a 3D model but I need to animate the cube's puzzle by unsolving it. I've tried to group the cubes or animate it by hand but they always move out of place after keying the 2nd and 3rd turn of 9 cubes.

Please help!! It's for a school assignment.

ewerybody
04-08-2008, 08:26 AM
yeah:
animateRubiksCube();

no just kidding. :D
Hey If you have problems with the animation then fix your setup! A script that animates it would cause the same problems, wouldn't it?

you don't have to group the pieces. Just put each pivot to the middle of the cube! Now select the sides and rotate with "global".

ah and I bet you already know. But if you have the cube "solved", then animate it shuffled and then flip the animation you'd have a nice solving animation :]

alredha
04-10-2008, 09:44 AM
i remember that once i started woking on it, but give it up in maya and turned to Max to achieve the animation as Max constraint has no jump when we switch between parents.

but i believe that it can be done in maya as well (just the fact to create a constraint then delete it, it prevents parent's jumping)

i'll give it a try,...hold on!

alredha
04-19-2008, 12:51 PM
this is not a full solution, try it out.

it only parents the cubes to groups, and play with that in the viewport, not animatable

to be able to animate it, you need to use parentConstraint instead the parenting, and also you need to avoid object jumping when you switch...<- this last i was almost to fanid a solution, sorry!

edit: forget to write how to use the script...

-open the scene
-source the script al_rubicube.mel
-execute al_rubicubeUI

you have here 9 buttons, each one corresponds to a specific row...
and don't forget to activate the Rotate snap to be sure that you reached the 90 degrees...

ewerybody
04-19-2008, 01:56 PM
i tried to find a solution myself. But its really not that easy. Problem is the euler angle animation. The Gimbal is locked at certain positions resulting in ugly animations. I doubt parentContraining helps to catch that.

I just tried around with the rotation order. Maybe that helps as it may turn a valid rotation axis in the needed direction. But i had no time for further investigation... :/

alredha
04-19-2008, 02:22 PM
i tried to find a solution myself. But its really not that easy. Problem is the euler angle animation. The Gimbal is locked at certain positions resulting in ugly animations. I doubt parentContraining helps to catch that.

I just tried around with the rotation order. Maybe that helps as it may turn a valid rotation axis in the needed direction. But i had no time for further investigation... :/

could you give a further explanations? cause i'm really intrested to find a solution.

what i meant by parent constraint, we need the object to not popup by setting the offset to its new parents, and that can be animated with step keyframes, i tried a solution with nodes and that almost done, but still having the CYCLE problem (which attribute is fed first). btw, the weigths must be either 1 or 0, no inbetween..

of course, that's what i still see as a possible solution...

edit: you are right for the gimble lock, parentConstraint doesn't handle it's objects rotation order...

geonak
04-22-2008, 10:29 PM
http://forums.cgsociety.org/showthread.php?f=26&t=623818&highlight=Rubik%27s

Regards

Georges

damat
04-23-2008, 10:35 AM
and also http://www.highend3d.com/maya/downloads/advanced_search.php?s%5Btitle%5D=rubik =)

geonak
04-23-2008, 12:16 PM
and also http://www.highend3d.com/maya/downloads/advanced_search.php?s%5Btitle%5D=rubik =)

hey damat in the link you gave and if you read carefully, there is only real time cubes ( i.e. not animatable), or not fully functinal cubes or very heavy cubes ...
of course unlinke mine which is fully functional, very flexible, very light, animatable ... etc

Regards

Georges

damat
04-23-2008, 02:24 PM
mmm... sorry for that =)

All I wanted to say was the following:
"HighEnd3d is very-very cool site for any cg needs. Go there and search before asking any questions".
It's my fault that I havent' really checked the results of the search, sorry again.

CGTalk Moderation
04-23-2008, 02:24 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.