ARKit node disappear after 100m

692 Views Asked by At

I'm currently working on ARKit (SceneKit) app. I've noticed that if I put a node at 100m, the node will show just fine but if I set it to 101m or farther, it won't show.

Is this the distance limit?

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)

Is there any way to increase this range?

2

There are 2 best solutions below

7
On

For increasing a Camera's range use Far attribute in Z Clipping area of Attributes Inspector.

The default value is 100 meters.

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 = 1000

This post provides an important info.

enter image description here

0
On

Looks like there is no way to update the Z maximum range for SpriteKit. Only SceneKit allows you to modify this by updating the zfar property from the camera. Thanks to Gigantic for your help!