1

I have a node with an SCNPlane whose corners I project to the image plane. I added an SCNBillboardConstraint to the node:

// orientation with billboarding
var billboardConstraint = SCNBillboardConstraint()
billboardConstraint.freeAxes = [.Y]        
labelSpriteNode.constraints = [billboardConstraint]

I am very surprised to see that this particular node's worldOrientation or orientation is not changed when I print it on every frame, despite me confirming visually that the orientation is truly changing as I move the camera around.

for labelComponent in labelComponents {
            if let sprite: SCNNode = labelComponent.childNode(withName: "sprite", recursively: true) {
                print("sprite.worldOrientation = \(sprite.worldOrientation)")
                print("sprite.orientation = \(sprite.orientation)")
           }
}

results with no changes:

sprite.worldOrientation = SCNVector4(x: 0.02127575, y: 0.1855893, z: -0.006851348, w: 0.9823732)
sprite.orientation = SCNVector4(x: 0.0, y: 0.0, z: 0.0, w: 1.0)
sprite.worldOrientation = SCNVector4(x: 0.02127575, y: 0.1855893, z: -0.006851348, w: 0.9823732)
sprite.orientation = SCNVector4(x: 0.0, y: 0.0, z: 0.0, w: 1.0)
sprite.worldOrientation = SCNVector4(x: 0.02127575, y: 0.1855893, z: -0.006851348, w: 0.9823732)
sprite.orientation = SCNVector4(x: 0.0, y: 0.0, z: 0.0, w: 1.0)
sprite.worldOrientation = SCNVector4(x: 0.02127575, y: 0.1855893, z: -0.006851348, w: 0.9823732)
sprite.orientation = SCNVector4(x: 0.0, y: 0.0, z: 0.0, w: 1.0)
sprite.worldOrientation = SCNVector4(x: 0.02127575, y: 0.1855893, z: -0.006851348, w: 0.9823732)
sprite.orientation = SCNVector4(x: 0.0, y: 0.0, z: 0.0, w: 1.0)
oneiros
  • 3,527
  • 12
  • 44
  • 71
  • @mnuages - I unfortunately, don't think it's a duplicate of that post. To summarize, the billboardConstraint adjusts the orientation so that the SCNPlane is facing me, but printing the worldOrientation or orientation of the SCNPlane still shows the same old values. I am really hoping you can help, or point out a misconception I might have – oneiros Feb 21 '19 at 15:09
  • 1
    Is you code reading the orientation on the `presentationNode`? – mnuages Feb 21 '19 at 15:46
  • I see - my code isn't reading the orientation on the `presentationNode` but rather on the node itself. I will rely on reading the value of the `presentationNode`. To be honest, I don't undersatnd why an `SCNBillboardConstraint` counts as changing the "transitory values" by "in-flight animations". – oneiros Feb 21 '19 at 16:09

0 Answers0