0
votes

I wanted to have all the SCNNodes rotate around an axis (says SCNVector3Zero at center). But when I do this:

for node in nodes {
  node.runAction(SCNAction.rotate(by: 3.14, around: SCNVector3Zero, duration: 0.5))
}

Nothing is moved. Changed to SCNAction.move instead of rotate works fine. Any idea?

I am testing in ARKit.

1

1 Answers

4
votes

SCNVector3Zero is the zero-length vector (0, 0, 0), it does not specify a direction or axis.

As an example, to rotate around the z-axis, use

SCNAction.rotate(by: .pi, around: SCNVector3(0, 0, 1), duration: 0.5)