I am attempting to have a text node in SceneKit always point towards me - that is towards my camera location. For some reason it does not rotate but stays static:
let text = SCNText(string: "My String", extrusionDepth: 0.1)
text.font = UIFont(name: "Arial", size: 10)
let textNode = SCNNode(geometry: text)
textNode.position = position
//Here I add the constraint to the SCNView's pointOfView node
let lookAtConstraint = SCNLookAtConstraint(target: scnView.pointOfView)
textNode.constraints = [lookAtConstraint]
What am I missing here?
There is actually a type of constraint for this specific purpose. It's called SCNBillboardConstraint
and it always orients the node it is assigned to towards the current camera. You don't even have to provide a target when initializing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.