SCNLookAtConstraint, specify how the node looks at the target node?
The documentation for SCNLookAtConstraint
notes:
When SceneKit evaluates a look-at constraint, it updates the constrained node's
transform
property so that the node's negative z-axis points toward the constraint's target node.
But SCNText
geometry is created facing forward along its positive z-axis, so your constraint system needs to account for that in some way. I advise using SCNBillboardConstraint
, which is designed for this kind of case. Its documentation says:
An
SCNBillboardConstraint
object automatically adjusts a node's orientation so that its local z-axis always points toward thepointOfView
node currently being used to render the scene.
With this, you shouldn't need to reparent the node.
The "SCNBillboardConstraint object automatically adjusts a node's orientation so that its local z-axis always points toward the pointOfView node currently being used to render the scene."
textNode.constraints = [SCNBillboardConstraint()]