loloof64 Posted August 1, 2014 Share Posted August 1, 2014 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. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 1, 2014 Share Posted August 1, 2014 Have you thought about parenting? Make on of the 9? the parent, move it, & all the others go with it. Nice thing about parenting is its pickup game nature. Merging meshes sounds more difficult to undo. Quote Link to comment Share on other sites More sharing options...
loloof64 Posted August 1, 2014 Author Share Posted August 1, 2014 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 Quote Link to comment Share on other sites More sharing options...
loloof64 Posted August 1, 2014 Author Share Posted August 1, 2014 I finally found the error I was calling Mesh#rotate() with wrong parameters order. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
rohan1231 Posted January 30, 2016 Share Posted January 30, 2016 Can you share the fixed code ? Quote Link to comment Share on other sites More sharing options...
aninja Posted February 25, 2016 Share Posted February 25, 2016 On 1/30/2016 at 2:23 AM, rohan1231 said: Can you share the fixed code ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.