Adding Realistic Movement To Your Rubik Cube Using SceneView and SwiftUI | by Mark Lucking | Mar, 2022

Picture by aaron boris on Unsplash
  • I wish to make my dice transfer like a Rubik dice, tilting the whole facet as I realign the faces.
  • I would like to have the ability to scramble my dice with the shake of the system and certainly reset it in an excellent world.
let centerCube = addBox(xAxis: 0, yAxis: 0, zAxis: 0)
greenCube = addColorBox(xAxis: 1, yAxis: -1, zAxis: 0, colour:UIColor.inexperienced)
whiteCube = addColorBox(xAxis: 1, yAxis: 1, zAxis: 0, colour:UIColor.white)
redCube = addColorBox(xAxis: -1, yAxis: 1, zAxis: 0, colour:UIColor.purple)
blueCube = addColorBox(xAxis: -1, yAxis: -1, zAxis: 0, colour:UIColor.blue)
centerCube.addChildNode(whiteCube)
centerCube.addChildNode(greenCube)
centerCube.addChildNode(redCube)
centerCube.addChildNode(blueCube)

The Value

More Posts