I want to rotate the Rubik's Cube using SceneKit.

Asked 2 years ago, Updated 2 years ago, 30 views

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.

ios swift

2022-09-30 17:15

1 Answers

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)


2022-09-30 17:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.