diff --git a/ios/RCTConvert+ARKit.m b/ios/RCTConvert+ARKit.m index 34d647e7..ae6d5f37 100644 --- a/ios/RCTConvert+ARKit.m +++ b/ios/RCTConvert+ARKit.m @@ -310,19 +310,8 @@ + (void)setMaterialPropertyContents:(id)property material:(SCNMaterialProperty * if (property[@"path"]) { SCNMatrix4 m = SCNMatrix4Identity; - // scenekit has an issue with indexed-colour png's on some devices, so we redraw the image. See for more details: https://stackoverflow.com/questions/40058359/scenekit-some-textures-have-a-red-hue/45824190#45824190 - - UIImage *correctedImage; - UIImage *inputImage = [UIImage imageNamed:property[@"path"]]; - CGFloat width = inputImage.size.width; - CGFloat height = inputImage.size.height; - - UIGraphicsBeginImageContext(inputImage.size); - [inputImage drawInRect:(CGRectMake(0, 0, width, height))]; - correctedImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - material.contents = correctedImage; + // scenekit has an issue with indexed-colour png's on some devices, See for more details: https://stackoverflow.com/questions/40058359/scenekit-some-textures-have-a-red-hue/45824190#45824190 to fix this we could re-implement https://github.com/react-native-ar/react-native-arkit/pull/171 in a more performant way + material.contents = property[@"path"]; if (property[@"wrapS"]) { diff --git a/ios/components/RCTARKitSpriteView.m b/ios/components/RCTARKitSpriteView.m index 2fd74286..44813438 100644 --- a/ios/components/RCTARKitSpriteView.m +++ b/ios/components/RCTARKitSpriteView.m @@ -22,7 +22,11 @@ @implementation RCTARKitSpriteView { - (CGAffineTransform)getTransform { SCNVector3 point = [[ARKit sharedInstance] projectPoint:self.position3D]; - CGAffineTransform t = CGAffineTransformMakeTranslation(point.x, point.y); + + // the sprite is behind the camera so push it off screen + float yTransform = point.z < 1 ? point.y : 10000; + + CGAffineTransform t = CGAffineTransformMakeTranslation(point.x, yTransform); return t; } @@ -40,7 +44,6 @@ - (void)renderer:(id)renderer updateAtTime:(NSTimeInterval)tim - (void)setTransformByProject { CGAffineTransform t = [self getTransform]; [UIView beginAnimations:nil context:NULL]; - [UIView setAnimationDuration:self.transitionDuration]; [self setTransform:t]; [UIView commitAnimations];