我想让我的节点的(中心和最大值)保持在 SCNode 的顶部(就像在 Quicklook 中一样)
但我需要将此函数从实体转换为 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)
}