Untitled
unknown
plain_text
a year ago
1.5 kB
6
Indexable
if let leftShoulderPoint = points[.leftShoulder], let leftWristPoint = points[.leftWrist], leftShoulderPoint.confidence > 0.5, leftWristPoint.confidence > 0.5 { let leftShoulder = CGPoint(x: CGFloat(leftShoulderPoint.location.x), y: CGFloat(leftShoulderPoint.location.y)) let leftWrist = CGPoint(x: CGFloat(leftWristPoint.location.x), y: CGFloat(leftWristPoint.location.y)) let leftArmAngle = angleBetweenPoints(from: leftShoulder, to: leftWrist) - .pi / 2 if let rightArmNode = scene?.rootNode.childNode(withName: "right_arm_joint", recursively: true) { rightArmNode.eulerAngles.y = Float(-leftArmAngle) } } if let rightShoulderPoint = points[.rightShoulder], let rightWristPoint = points[.rightWrist], rightShoulderPoint.confidence > 0.5, rightWristPoint.confidence > 0.5 { let rightShoulder = CGPoint(x: CGFloat(rightShoulderPoint.location.x), y: CGFloat(rightShoulderPoint.location.y)) let rightWrist = CGPoint(x: CGFloat(rightWristPoint.location.x), y: CGFloat(rightWristPoint.location.y)) let rightArmAngle = angleBetweenPoints(from: rightShoulder, to: rightWrist) + .pi / 2 if let leftArmNode = scene?.rootNode.childNode(withName: "left_arm_joint", recursively: true) { leftArmNode.eulerAngles.y = Float(rightArmAngle) } }
Editor is loading...
Leave a Comment