Group Group Group Group Group Group Group Group Group

Updates to the book etc & how to use SceneKit with AR Kit?


Can anyone say when there might be updates to the book & the chapters that have not been distributed so far?

I am quite keen to see more in depth examples of using SceneKit with ARKit.

I have been seeing some inconsistent results with using SCNActions with AR Kit. I don’t know if it my code or ARKit.

I have been trying to create some action sequences like the following:

    let fadeInAction = SCNAction.fadeIn(duration: 2.0)
    let fadeOutAction = SCNAction.fadeOut(duration: 1.5)

    let action = SCNAction.moveBy(x: 0, y: -0.4, z: 0, duration: 3)
    let rotate = SCNAction.repeatForever(SCNAction.rotate(by: .pi, around: SCNVector3(0, 0, 1), duration: 3))
    let group =[action, rotate])

    // I saw online that some people where reporting that removeFromParentNode does not work if the node
    // has a material reference
    let blockAction = { (node) in
        node.geometry?.firstMaterial!.diffuse.contents = nil

    let sequence = SCNAction.sequence([fadeInAction, group, fadeOutAction, blockAction,           SCNAction.removeFromParentNode()])

The sequence as is does not work:

  • there is no fade in or fade out
  • there is no rotation
  • the node does not get removed

If I reduce the sequence to just the move & removeFromParentNode it works.

I believe SCNAction.repeatFoever is the problem. It does exactly that it repeats forever, so the group its part of is executed forever.

Yes. Thanks for the reply. That is one of the problems. :grinning:

I am currently doing some testing of action sequences using a swift a playground. I will be happy to share a link when it is more complete.

I have crested a Swift playground using SCNActions: SceneKit SCNActions Swift Playground