I'm trying to create an app for Rubik's Cube using SceneKit.
I was able to make 27 blocks of Rubik's Cube using SCNNode(), but I am having trouble with the rotation of the blocks.
Please let me know how to rotate it around any block or if there are any references.
Thank you for your cooperation.
I was able to solve this problem by using the position and pivot properties.
When I wanted to rotate the block (boxNode) of coordinates (x, y, z) to the center of the origin (0, 0, 0), it was Ok if I did the following.Also, you can use runAction() to determine the axis of rotation.
boxNode.pivot=SCNMatrix4MakeTranslation (-x, -y, -z)
boxNode.position = SCNVector3 (x:0, y:0, z:0)
© 2024 OneMinuteCode. All rights reserved.