I have been using UIKit to build out a relatively complex SceneKit scene with 2D labels that are being composed over nodes in the scene. I am using the following to fetch the subview 'names' and projecting their 3D position as a 2D point, and then setting the centre of the label views as this point. Code is below:
Project point:
let projectedPoint = renderer.projectPoint(node.position)
let screenPoint = CGPoint(x: CGFloat(projectedPoint.x), y: CGFloat(projectedPoint.y))
return screenPoint
Absolute position update:
viewTest.center = self.getScreenPoint(renderer: renderer, node: node)
What is the SwiftUI version of this approach? I have used a published array containing all CGPoints, but it lags and becomes non-responsive after a few seconds of interactions.
Thank you - happy to share more code is needed!