Jump to content

Problem with my Rubik's Cube groups


loloof64
 Share

Recommended Posts

Hello,

 

I am trying to build a Rubik's Cube (see my attemps in BabylonJs playground http://www.babylonjs.com/playground/#EQ0SF).

 

Each little cube is a mesh on its own (UnitCube builder function), so I am trying to group temporary some of them into a single Mesh, in order to rotate the group, but it does not works (into methods 

  • clearGroupToRotate()
  • affectWholeCubeToRotatedGroup()
  • affectLayerToRotate()

of Rubik's cube class).

 

What workaround could you advise me ?

 

Regards.

Link to comment
Share on other sites

Thank you for your answer.

 

Indeed, it is what I tried inside the two methods affectWholeCubeToRotatedGroup() and affectLayerToRotate() of the RubiksCube class :

  • the class holds a reference to a Mesh (groupToRotate, defined in line 185), which is responsible for holding a single group of UnitCube at one time,
  • when I want to "clear the group" : I simply define the property parent of the requested UnitCubes to null (line 232)
  • when I want to "assign a group" : I simply define the property parent of the requested UnitCubes to link to this groupToRotate (line 239)
  • and of course, when I want to rotate the group, I call the rotate() method on the groupToRotate (line 280).

But what happens, is that as soon the rotation should have taken place, the Rubik's Cube disappear from screen.

 

Regards

Link to comment
Share on other sites

  • 1 year later...
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...