Skip to content
Prev Previous commit
Next Next commit
improve
  • Loading branch information
macrozone committed Oct 17, 2017
commit 5049bfd9af79df6cd6a246b9d37fd7f8d9c16d83
35 changes: 18 additions & 17 deletions ios/RCTARKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -435,26 +435,27 @@ - (void)session:(ARSession *)session didUpdateFrame:(ARFrame *)frame {
}
}
if (self.onFeaturesDetected) {
NSMutableArray * featurePoints = [NSMutableArray array];
for (int i = 0; i < frame.rawFeaturePoints.count; i++) {
vector_float3 point = frame.rawFeaturePoints.points[i];

NSString * pointId = [NSString stringWithFormat:@"featurepoint_%lld",frame.rawFeaturePoints.identifiers[i]];

[featurePoints addObject:@{
@"x": @(point[0]),
@"y": @(point[1]),
@"z": @(point[2]),
@"id":pointId,
}];

}
dispatch_async(dispatch_get_main_queue(), ^{

NSMutableArray * featurePoints = [NSMutableArray array];
for (int i = 0; i < frame.rawFeaturePoints.count; i++) {
vector_float3 point = frame.rawFeaturePoints.points[i];

NSString * pointId = [NSString stringWithFormat:@"featurepoint_%lld",frame.rawFeaturePoints.identifiers[i]];

[featurePoints addObject:@{
@"x": @(point[0]),
@"y": @(point[1]),
@"z": @(point[2]),
@"id":pointId,
}];

}

if(self.onFeaturesDetected) {
self.onFeaturesDetected(@{
@"featurePoints":featurePoints
});
self.onFeaturesDetected(@{
@"featurePoints":featurePoints
});
}
});
}
Expand Down