arkit

iPhone X Flashlight turns off when AR Camera is enabled

孤人 提交于 2019-12-14 03:47:20
问题 I am building an AR app that needs the flashlight to be turned on torch mode. Turning on torch mode and then enabling the AR scene works fine on my iPhone 8, but on the iPhone X, it the flashlight turns on and then off again. Is there some way around this, or something specific I have to do for the iPhone X to work? - (void)turnTorchOn:(bool) on { Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice"); if (captureDeviceClass != nil) { AVCaptureDevice *device = [AVCaptureDevice

ARKit : how to get a SCNNode hit by hitTest?

我的梦境 提交于 2019-12-14 02:07:34
问题 I have several planes detected by ARKit and made visible to the user. I want the user to be able to click on the screen in order to keep only the plane he selected, change its color and delete the other ones. My planes are added in the didAddNode delegate method like this: Plane *plane = [[Plane alloc] initWithAnchor: (ARPlaneAnchor *)anchor]; [self.planes setObject:plane forKey:anchor.identifier]; In another method, I catch the click of the user and want to be able to change the color of the

Get “[SceneKit] Error:” when set AVPlayer to SCNMaterial.diffuse.contents

耗尽温柔 提交于 2019-12-14 00:27:14
问题 According Apple's docs, SCNMaterial.diffuse.contents can be a AVPlayer . In this case material appear content of video. Everything seems ok but I get several sceneKit error logs: [SceneKit] Error: Could not get pixel buffer (CVPixelBufferRef) Below is my code. Move [_player play] to viewWillAppear does't help. - (void)viewDidLoad { [super viewDidLoad]; self.boxNode = [self.sceneView.scene.rootNode childNodeWithName:@"box" recursively:YES]; NSString *path = [[[NSBundle mainBundle] resourcePath

SCNNode Z-rotation axis stays constant, while X and Y axes change when node is rotated

瘦欲@ 提交于 2019-12-13 16:13:33
问题 I have a node that the user can rotate via a pan gesture. The user can select either X, Y, or Z axis and pan, and the node will rotate around that axis. The Issue : The node's front is facing the camera. Let's say the user pans to the right and rotates the node around the Y axis. The node's front is now facing the right. If the user switches to the X axis and pans down, the node's front will rotate downward (or clockwise from the user's perspective) from it's initial right-facing orientation.

How to create a SCNNode from a .usdz?

耗尽温柔 提交于 2019-12-13 15:27:15
问题 I have downloaded the .usdz models provided by Apple: https://developer.apple.com/arkit/gallery/ But now, I want to create a SCNNode with one of these models, so I am doing this to obtain the node: guard let urlPath = Bundle.main.url(forResource: "retrotv", withExtension: "usdz") else { return } let mdlAsset = MDLAsset(url: urlPath) let modelRootNode = SCNScene(mdlAsset: mdlAsset).rootNode Then I add it to the scene and the result is this: Why does it have no textures? I have the downloaded

ARKit Image detection Freezing camera

北战南征 提交于 2019-12-13 13:30:20
问题 I had image detection working properly in ARKit 1.5, but in ARKit 2.0 whenever I launch my application it freezes after what looks like 1 frame of the camera. I can still interact with an object that automatically spawns on the screen, but the camera stops updating. I am using the Unity plugin and every time I change the fields under Image Tracking in the Unity AR Camera Manager script I seem to have this problem. Has anyone else experienced this? 回答1: This bug is occurred on below

Get the direction arrow toward the SCNNode once that node is not visible in ARCamera

本秂侑毒 提交于 2019-12-13 12:41:18
问题 If ARCamera moving left, right, up or down and if that node becomes invisible in ARCamera. I want to indicate the arrow that you need to move camera up/down/right/left. 回答1: if let pointOfView = sceneView.pointOfView{ let isMaybeVisible = sceneView.isNode((displayNode.presentation), insideFrustumOf: pointOfView) if isMaybeVisible{ if arrowVisible{ arrow.removeFromParentNode() } }else{ if !arrowVisible{ sceneView.pointOfView?.addChildNode(arrow) } } } isNode(_:insideFrustumOf:) here checks if

ARKit image detection, add image

北慕城南 提交于 2019-12-13 05:11:46
问题 I'm using ARKit 1.5 (beta) for image detection. Once I detect my image I would like to then place a AR scene image using the plane detected. How can this be done? My code so far which detects the image (which is in my assets folder): /// - Tag: ARImageAnchor-Visualizing func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { guard let imageAnchor = anchor as? ARImageAnchor else { return } let referenceImage = imageAnchor.referenceImage updateQueue.async { //

ARKIT : SKVideoNode continue playing while node is out of scene, pause is not working

断了今生、忘了曾经 提交于 2019-12-13 03:46:54
问题 I am implementing a demo project using SceneKit and ARKit where i keep camera on some picture and play video from url. Everything works fine but i could not be able to stop previous video and it starts another video. Previous video plays on background. It happens sometimes when i switch image. My implementation is : @IBOutlet var sceneView: ARSCNView! var videosNames = [String]() var player = AVPlayer() var videoNode = SKVideoNode() In viewDidload, sceneView.delegate = self // Create a

How to place 3D object (.scn file) on detected vertical plane which should be parallel to plane in ARKIt?

我的梦境 提交于 2019-12-13 03:45:35
问题 I am going to detect horizontal and vertical plane in ARKit. After detecting whether it is horizontal or vertical surface, respectively add plane of gray color on detected surface.On tap on detected plane I am going to add 3D object of .scn file. My code is working fine for placing 3D object (.scn file) on horizontal plane but not working correctly with vertical plane. 3D object (.scn file) for vertical plane like photo frame is facing right in SceneKit editor. So I changed it’s EularAngleY