'convert Entity to SCNode ARSCNView
I would like to get the (center & max) of my node to stay title top of SCNode (exactly like in the Quicklook)
but i need to convert this func from Entity to SCNode:
func getPoint(for scaleEntity: Entity) -> CGPoint {
let framePosition = arView.project((scaleEntity.parent?.visualBounds(relativeTo: nil).center)!)
let visualBoundExtend = arView.project((scaleEntity.parent?.visualBounds(relativeTo: nil).max)!)
guard var posY = visualBoundExtend?.y, var posX = framePosition?.x else { return CGPoint(x: 0, y: 0)}
posX = posX < 0 ? 0 : posX * 1
posY = posY < 0 ? 0 : posY * 1
if posX > viewMaxBounds.x {
posX = viewMaxBounds.x - 30
}
if posY > viewMaxBounds.y {
posY = viewMaxBounds.y - 30
}
return CGPoint(x: posX, y: posY)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
