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
}