swift - iOS – ARKit 节点在 100 米后消失

标签 swift sprite-kit augmented-reality arkit scncamera

我目前正在开发 ARKit (SpriteKit) 应用程序。我注意到,如果我将一个节点放在 100 米处,该节点会显示得很好,但如果我将它设置为 101 米或更远,它就不会显示.

这是距离限制吗?

var translation = matrix_identity_float4x4
translation.columns.3.x = 1
translation.columns.3.y = 1
translation.columns.3.z = -100
let transform = simd_mul(currentFrame.camera.transform, translation)
let anchor = ARAnchor(name: "test", transform: transform)
sceneView.session.add(anchor: anchor)

有什么办法可以增加这个范围吗?

最佳答案

要增加相机的范围,请使用属性检查器的 Z Clipping 区域中的 Far 属性。

默认值为 100 米。

enter image description here

var zFar: Double { get set }

Excerpt from Developer Documentation: The far value determines the maximal distance between the camera and a visible surface. If a surface is farther from the camera than this distance, the surface is clipped and does not appear. The default far value is 100.0.

let camera = SCNCamera()
camera.zFar = 10000

enter image description here

关于swift - iOS – ARKit 节点在 100 米后消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52788280/

相关文章:

ios - Swift 问题 - NSUserDefault 和设置包没有响应

ios - SWRevealViewController - 从侧面菜单中推送 View Controller

android - ARCore 不显示对象的真实尺寸

ios - ARKit3 如何使用TrueDepth相机进行面部跟踪和其他人的面部网格?

ios - Swift:将本地通知转换为用户通知 IOS 10

swift - 在 Storyboard中创建继承属性的导出

ios - 如何为场景设置背景颜色?

swift - 另一个类中的委托(delegate)

ios - SpriteKit : How to detect touches on node that began outside of node

android - 如何使用 Android SDK 开发增强现实应用程序?