rubiks cube in panda3d

599 Views Asked by At

I'm new to panda and i'm trying to create simple game with rubiks cube. I've already created small cubes from GeomVertexData like in procedural-cube tutorial in samples of panda3d. Then i arrange 26 cubes so they looks like rubiks cube and now i'm struggling with wall rotation, so i find out in internet that best way to rotate model around point is to create dummy node

pivotNode = render.attachNewNode('node')

attach it to model

cube.wrtReparentTo(pivotNode)

and then rotate that node. So I've done that, and everything is working fine to the moment when i'm trying to rotate multiple rubiks walls e.g. front and then left as they have common cubes.

rotating code looks like that

pivotNode = render.attachNewNode('node')
for cube in getRight(cubes):
    cube.wrtReparentTo(pivotNode)
pivotNode.hprInterval(0.25,L_R_rotation).start()

and here is my question what would be best option to rotate those walls as when i do: 1. attach 9 cubes of front wall to dummy node 2. rotate dummy node 3. attach 9 cubes of left wall to new dummy node 4. rotate second dummy node won't work properly.

please advise.

0

There are 0 best solutions below