2017-09-21 5 views
0

リンゴによるarkitのコード例このエラーが発生しました '[vector_float3]'(別名 'Array')の値何のメンバーが、それは私がこのコードタイプ '[vector_float3]'(別名 'アレイ<float3>')にはメンバー 'advanced'がありません

func hitTestWithFeatures(_ point: CGPoint, coneOpeningAngleInDegrees: Float, 
          minDistance: Float = 0, 
          maxDistance: Float = Float.greatestFiniteMagnitude, 
          maxResults: Int = 1) -> [FeatureHitTestResult] { 

     var results = [FeatureHitTestResult]() 

     guard let features = self.session.currentFrame?.rawFeaturePoints else { 
      return results 
     } 

     guard let ray = hitTestRayFromScreenPos(point) else { 
      return results 
     } 

     let maxAngleInDeg = min(coneOpeningAngleInDegrees, 360)/2 
     let maxAngle = ((maxAngleInDeg/180) * Float.pi) 

     let points = features.points 

     for i in 0...features.__count { 

      let feature = points.advanced(by: Int(i)) 
      let featurePos = SCNVector3(feature.pointee) 

      let originToFeature = featurePos - ray.origin 

      let crossProduct = originToFeature.cross(ray.direction) 
      let featureDistanceFromResult = crossProduct.length() 

      let hitTestResult = ray.origin + (ray.direction * ray.direction.dot(originToFeature)) 
      let hitTestResultDistance = (hitTestResult - ray.origin).length() 


      // All tests passed: Add the hit against this feature to the results. 
      results.append(FeatureHitTestResult(position: hitTestResult, 
               distanceToRayOrigin: hitTestResultDistance, 
               featureHit: featurePos, 
               featureDistanceToHitResult: featureDistanceFromResult)) 
     } 

     // Sort the results by feature distance to the ray. 
     results = results.sorted(by: { (first, second) -> Bool in 
      return first.distanceToRayOrigin < second.distanceToRayOrigin 
     }) 

     return cappedResults 
    } 

答えて

6

私は同じ問題を抱えていたを使用していXCodeの9のベータ版やGMのバージョン

で罰金働いていた 「を進んない」は、喜んで解決しました。 https://developer.apple.com/library/content/samplecode/AudioInARKit/Listings/Audio_in_ARKit_ARSCNView_HitTests_swift.html

ほんの少しの変更を、あなたは大丈夫です::Appleはすでにここに、この例を更新しました

let points = features.__points 

の代わり:

let points = features.points 

が、これは

を役に立てば幸い
関連する問題