Experiment #05: Rubik’s Cube

rubikscube

view | download | PV3D类库

Bookmark and Share

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Comments :

  • At 2009.04.29 15:58, Sami said:

    Hi,

    I've tried out the code you have there and getting this error here:
    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at RubiksCubeDemo/init()
    at RubiksCubeDemo()

    Do you know what might goes wrong?

    Nice Demo btw. Cheers.

  • At 2009.04.30 05:14, Kevin Cao said:

    Do you compile my code without modification?
    or you can trace(rubiksCube) after line:88 to see whether rubiksCube works fine.

  • At 2009.04.30 10:59, Sami said:

    Yes I didnt change anything on it. What I did is,
    1. I create a new fla file that have class file pointed to that file you made.
    2. I downloaded and path the gs tweenlite package on the flash, since your AS file is searching for it.
    3. I compile the fla file, and it keep saying that error.

    I've tried the trace(rubiksCube) as you said, the output still saying the same error, and the trace doesnt show anything. Do you know what's wrong with what Im doing?

    Thx very much for the reply.

  • At 2009.05.01 11:12, Sami said:

    Hi,

    I've finally got it working. Just realized that I have to use flex builder to do this. Sorry for the stupid question :)

  • At 2009.05.04 08:46, Kevin Cao said:

    Yep, I've use [embed] tag to attach assets. Glad to see you finally figure it out by yourself. Any questions are welcome.

  • At 2009.05.19 07:55, chris albon said:

    Seriously groovy work. Thnx for posting source code. I'm new to Flex but have tried to get this working using AS3 and Flex. I am able to compile without the above error by disabling stage references in the RKdemo class but can't get any kind of renders.
    Traces on classes give me x and y values of 0??

  • At 2009.05.19 13:28, chris albon said:

    skip that, works now…you're a very good listener!

  • At 2009.05.19 14:28, Kevin Cao said:

    ;) cheers

  • At 2009.05.20 09:40, chris albon said:

    Me again. :)
    I'm trying to get this working outside of flex. I've amended to code to use file material instead of Embed and it works as such in Flex but still won't render in Flash.

    I've had a fair old crack at it this time and still can't figure it out. Would you mind taking a look please?

    http://www.ifsandands.com/rubCuibe.rar

  • At 2009.05.20 14:19, Kevin Cao said:

    addChild(test); // seems you forgot add test to display list

  • At 2009.05.21 09:49, chris albon said:

    *sobs* I can't believe it!
    Thanks again!

  • At 2009.07.11 16:41, biozoid said:

    Hey Kevin, I have made my own RC portfolio with your kind help. http://www.odbo.co.uk
    This is my first venture into Papervision AS3 so your help was much appreciated.

    The site is entirely XML driven, PM me if you want the source.

  • At 2009.07.13 23:26, Kevin Cao said:

    Congratulations, you've done a good job using "Rubikscube". Keep going!

  • At 2009.08.31 17:36, Dudu said:

    Hello,
    How to add event when I click on a cube face in this sample?
    I tried but no success. Anyone can help me please?

    BR,
    Dudu

  • At 2009.08.31 17:42, Dudu said:

    Hello,

    I`m using this cube but I don`t know how to add event when I click in the cubes.
    I have added InteractiveScene3DEvent, and MouseEvent to my cube object but I can`t get when the cube is clicked.

    Can you help me?
    BR,
    Dudu

  • At 2009.09.03 01:14, Kevin Cao said:

    Did you set interactive material to the cube?

  • At 2009.09.03 01:17, Dudu said:

    What do you mean by setting interactive material to the cube?

    I using as I downloaded and put to listen the events to the cube. I tried InteractiveScene3DEvemt, MouseEvent and when I click in the cube, nothing happens.

    Can you help me please?
    BR,
    Dudu

  • At 2009.09.03 03:10, Dudu said:

    Yes, I set

    frontMat.interactive = true;

    But doens't work also.

  • At 2009.09.03 15:41, Kevin said:

    You need to set event handler for each child “cube”:
    for(var i : uint = 0;i < 26; i++) {
    rubiksCube.getChildByName("cube" + (i + 1)).addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, clickHandler);
    }

  • At 2009.09.08 22:47, Dudu said:

    Hello Kevin,

    I tried this and didn't work. I remove the stage listener and not happened.
    I'm using this version of papervision: Papervision3D 2.1 rev920 (August 11th, 2009)
    Could I send my code for you or could you send me a code with the click event working in this cube?

    Thanks you very much,
    Dudu

  • At 2009.09.09 01:49, Dudu said:

    Thank you very much Kevin….

    I was missing var cube : DisplayObject3D = event.target as DisplayObject3D;

    BR,
    Dudu

  • At 2009.09.09 07:51, Kevin said:

  • At 2009.09.09 14:05, Dudu said:

    Hello,

    Do you know how can I modify to rotate the cube in the middle?
    Because today the axis in the middle it`s not rotating.

    BR,
    Dudu

  • At 2009.09.10 07:54, Kevin said:

    what do you mean “cube in the middle”?

  • At 2009.09.14 14:37, Dudu said:

    Let me try to explain:

    we have the cube and today when press the key "l" rotate the left, "r" right, "d" down… and so son but I need to rotate the main axis (the cubes between left ("l") and right ("r").

    If it`s no clear I can make an image and show u.
    BR,
    Dudu

  • At 2009.09.15 07:43, Kevin said:

    It’s impossible to rotate the “middle cubes” in a real rubik’s cube, but if you just want it that way, you must develop it by yourself.

  • At 2009.09.16 10:25, Sami said:

    Hi Kevin, its me again.. Im trying to make a rubiks cube game based on this. Is there any way to trace when people already solved the rubiks. I know we can keep record of the single movement they've made, however people will have all sort of movements and different types of solution for the rubiks. Is there any way to tell the system that, ok the rubiks is solved now, all the sides have the same color, then do this.

    Your help is greatly appreciated man.

    Thanks

  • At 2009.09.21 00:02, Kevin Cao said:

    One thing I came out is to check each cube's transform matrix when single rotation animation is done. But the code need to be seriously rewrited. Definitely, there must be better algorithm, but I can't find any useful information right now.
    Good luck!

  • At 2009.12.01 05:35, Bull said:

    what to change in the code if I want to rotate the middle pieces also.