swift - 如何用lefteyetransform ARKit2移动圆圈
问题描述
我正在尝试开发一个根据左眼移动圆圈的游戏
let screenSize = UIScreen.main.bounds
let screenWidth = screenSize.width
let screenHeight = screenSize.height
let camera = self.sceneView.session.currentFrame?.camera
let pippo = simd_mul((anchor.transform),faceAnchor.leftEyeTransform)
var j: SCNVector3 = SCNVector3(pippo.columns.3.x ,pippo.columns.3.y , -pippo.columns.3.z);
self.circlePath = UIBezierPath(arcCenter: CGPoint(x: CGFloat( j.x * Float(screenHeight/2) ),y:CGFloat( j.y * Float(screenWidth/2) )), radius: CGFloat(20), startAngle: CGFloat(0), endAngle:CGFloat(Double.pi * 2), clockwise: true)
self.shapeLayer = CAShapeLayer()
self.shapeLayer.path = self.circlePath.cgPath
self.shapeLayer.fillColor = UIColor.clear.cgColor
self.shapeLayer.strokeColor = UIColor.red.cgColor
self.shapeLayer.lineWidth = 3.0
self.view.layer.addSublayer(self.shapeLayer)
我移动了一点圆圈,但它以屏幕的最左侧为中心(而不是在中间)并且移动并没有覆盖整个屏幕,而只是其中的一部分,我该如何解决?提前致谢。
解决方案
推荐阅读
- react-native - 在 react-native 中使用加密数据库
- jquery - 如何将数字格式化为小数点前始终为两位数
- html - 使用twitter bootstrap在两个div之间的css垂直对齐中间
- maven - javax.servlet.ServletException:org.primefaces.context.RequestContext.getCurrentInstance
- typescript - 如何重置 VSCode Typescript 版本
- r - R 将向量扩展为围绕中心值的相同长度
- java - 回调获取响应同步 kotlin
- c# - 在 C# 中的 ActiveX 控件中的文本框中添加换行符
- image - Drupal 8:如何在模板 page.html.twig 中获取用户字段图像
- javascript - 在 NativeScript 对话框上显示 FontIcon