SCNText does not stay at defined position

Hi everyone!


I am new to ARKit and have encountered a problem that I cannot get my head around.


I previously placed boxes, rings, pyramids from the Scene kit to a fixed position using the following code:


let node = SCNNode()

node.geometry = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0)

node.position = SCNVector3Make(0.1, 0.1, -0.1)

self.sceneView.scene.rootNode.addChildNode(node)


This worked fine and a box appeared at a fixed position.



I then want to insert some text or label using this code:


let node = SCNNode()

node.geometry = SCNText(string: "Hello World", extrusionDepth: 0.1)

node.position = SCNVector3(-50,-5,-50)

self.sceneView.scene.rootNode.addChildNode(node)


I can see the text in front of me, however it moves with the phone in the vertical and horizontal direction rather than staying at a fixed position in comparison to the origin.


Is there a step that I missed?



Any help would be greatly appreciated!



Many thanks,

Leo

Replies

Hi,


had the same problem. For me it was the dimension. Try to shrink your text font and node. Try font size 0.40 and scale the node with 0.1 for x, y and z. And do not put your text so far out. This caused the bug for me.


Hope it helps.