1

I want to perform a hit testing from a point on the screen to a Cube in a 3D world. I've been using hitTest from ARKit. It works when I'm standing close to the cube, but when I start moving backwards, it stops working. I'm assuming this is because it's locked to the camera's zRange.

I've tried to set the clipToZRange option to false, like so:

let hits = self.sceneView.hitTest(loc, options: [SCNHitTestOption.clipToZRange: false])`

but it doesn't seem to have any effect.

Am I not setting the option right, or is this a bug?

I am using the latest Xcode and iOS betas.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
krntz
  • 613
  • 1
  • 6
  • 11

1 Answers1

4

Turns out the showFeaturePoints debug option from ARKit interferes with hitTest...

krntz
  • 613
  • 1
  • 6
  • 11
  • 1
    After some further testing, it seems like showFeaturePoints breaks a whole lot of things. Object tracking is very jittery when the feature points are turned on, but when they are off the objects are rock-solid. – krntz Jul 27 '17 at 12:22
  • this is especially true if you are hitTesting for .featurePoint eg `let hitResults = sceneView.hitTest(touch, types: .featurePoint)`... but when filtering for `.existingPlaneUsingExtent` for example, I did experience jittery tracking, but observed few if no interference problems with hitTesting... – user3325025 Apr 04 '18 at 01:06