如何旋转3d usdz模型在抽头方向与realityKit?



我能够使用点击的2d点从光线投射中获得世界变换,现在假设3d usdz模型面向完全相反的方向,并使用图像跟踪放置在图像上,我必须动态旋转该模型,使其面指向用户点击的方向。

注意:-角度应根据光线投射结果动态计算。

设置模型的旋转,使其绕y轴旋转0.pi弧度。

let rotationTransform = Transform.init(pitch: 0, yaw: .pi, roll: 0)
let newTransform = simd_mul(modelInitialTransform, rotationTransform.matrix)
model.move(to: newTransform, relativeTo: nil, duration: 0.3, timingFunction: .easeInOut)

最新更新