I am using an ARSCNView and an SKView to match 3D objects scanned in augmented reality with 2D objects on a plane. Because the coordinate system changes every time the ARSCNView is started, I want to determine the offset distance and angular difference between the two coordinate systems based on (alignWall3DNode: SCNNode, alignWall2DNode: SKNode).
// 1. Convert the rotational angle to the same coordinate system
let wall2DAngle = alignWall2DNode.zRotation
let wall3DAngle = -CGFloat(alignWall3DNode.simdTransform.eulerAngles.y)
// 2. Calculate the difference
var angleDis = wall2DAngle - wall3DAngle
// 3.Rotate counterclockwise to the skview coordinate system
var scnConvertToSkPosition = CGPoint(x: CGFloat(alignWall3DNode.position.x), y: CGFloat(alignWall3DNode.position.z)).rotateAround(point: CGPoint.zero, by: angleDis)
May I ask, is the position obtained in this way the correct position for alignWall3DNode to be moved into SKView? Because when I use this point for other things, I cannot achieve the ideal state.