arkit

ARKit floating planes

自古美人都是妖i 提交于 2019-12-06 16:34:08
Sometimes ARKit creates plane over existing one. It doesn't merge them. I am testing ARKit with iPhone 7 in closed space. Object placed on that plane appears to float in space. This scenario doesn't happen often, and I can't reproduce it all the time. Can someone tell me how to prevent overlapping and floating planes to appear? Or how to place 3D object on bottom plane? Here is the code for drawing planes. func createPlaneNode(center: vector_float3, extent: vector_float3) -> SCNNode { let plane = SCNPlane(width: CGFloat(extent.x), height: CGFloat(extent.z)) let planeMaterial = SCNMaterial()

Set text programmatically of an Entity in Reality Composer - iOS 13

别说谁变了你拦得住时间么 提交于 2019-12-06 16:05:18
In my iOS app I want to introduce a part of AR using the new Reality Composer. In my project I load a scene with this code: let arView = ARView.init(frame: frame) // Configure the AR session for horizontal plane tracking. let arConfiguration = ARWorldTrackingConfiguration() arConfiguration.planeDetection = .horizontal arView.session.run(arConfiguration) arView.session.delegate = self self.view.addSubview(arView) Experience.loadSceneAsync{ [weak self] scene, error in print("Error \(String(describing: error))") guard let scene = scene else { return } arView.scene.addAnchor(scene) // THIS IS THE

Not able to add texture image to a cube in ARKit

限于喜欢 提交于 2019-12-06 15:30:34
问题 I am not able to add an image to the cube in ARKit using the "Material" object. Here is the code: import UIKit import SceneKit import ARKit class SimpleBoxViewController: UIViewController, ARSCNViewDelegate { var sceneView: ARSCNView! override func viewDidLoad() { super.viewDidLoad() self.sceneView = ARSCNView(frame: self.view.frame) self.view.addSubview(self.sceneView) sceneView.delegate = self sceneView.showsStatistics = true let scene = SCNScene() let box = SCNBox(width: 0.2, height: 0.2,

What are the first two columns in SCNMatrix4

元气小坏坏 提交于 2019-12-06 14:51:11
问题 I was reading the documentation for this struct but there seem not be enough information, m3 being the 3rd column of the matrix and m4 the 4th column contain the information about orientation and location of the node in 3D space correspondingly that I know because of some course on Udemy. Also right now the only way to extract the orientation and other things is: guard let pointOfView = sceneView.pointOfView else { return } let transform = pointOfView.transform let orientaiton = SCNVector3(

ARKit - Update only the world coordinates origin

て烟熏妆下的殇ゞ 提交于 2019-12-06 14:46:28
问题 Once the user has scanned the environment and that I detected a plane, I would like the world origin anchor, which is the device position when the app opens (which is the origin of the 3D world), to be reset to where my device is right now so that the user can see my AR objects in front of him. (my objects are floating and not related to the floor but detecting a plane makes the objects more stable) I didn't find a way to do that. It's linked to ARConfiguration but it doesn't seem like we can

ARKIT : place object on a plane doesn't work properly

ぐ巨炮叔叔 提交于 2019-12-06 14:29:06
I am learning ARKit and trying to place an object on a detected plane. But it doesn't work properly and there's a space between the plane and the 3D object. here's my code for the plane detection : func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { position = SCNVector3Make(anchor.transform.columns.3.x, anchor.transform.columns.3.y, anchor.transform.columns.3.z) guard let planeAnchor = anchor as? ARPlaneAnchor else { return } let plane = SCNPlane(width: CGFloat(planeAnchor.extent.x), height: CGFloat(planeAnchor.extent.z)) planeNode = SCNNode(geometry:

Difficulty getting depth of face landmark points from 2D regions on iPhone X (SceneKit/ARKit app)

試著忘記壹切 提交于 2019-12-06 14:27:53
I'm running face landmark detection using the front-facing camera on iPhone X, and am trying very hard to get 3D points of face landmarks (VNFaceLandmarkRegion2D gives image coordinates X, Y only). I've been trying to use either the ARSCNView.hitTest or ARFrame.hitTest , but am so far unsuccessful. I think my error may be in converting the initial landmark points to the correct coordinate system. I've tried quite a few permutations, but currently based on my research this is what I've come up with: let point = CGPoint(x: landmarkPt.x * faceBounds.width + faceBounds.origin.x, y: (1.0 -

How to dynamically create annotations for 3D object using scenekit - ARKit in iOS 11?

℡╲_俬逩灬. 提交于 2019-12-06 12:03:54
问题 I am working on creating annotations using overlaySKScene something similar to this(https://sketchfab.com/models/1144d7be20434e8387a2f0e311eca9b1#). I followed https://github.com/halmueller/ImmersiveInterfaces/tree/master/Tracking%20Overlay to create the overlay. But in the provided example, they are creating only one annotation and it is static. I want to create multiple annotations dynamically based on the number of child nodes we have and also should be able to position annotation on top

Why would Xcode show MUCH more memory use than Instruments for SceneKit app?

安稳与你 提交于 2019-12-06 10:48:46
I'm trying to debug why our SceneKit-based app is using so much memory but Xcode and Instruments / Allocations seem to have very different values for the amount of memory being used. When I look in Xcode I see something like 600 MB but when I transfer the same running session over to Instruments / Allocations, I see a very different number for persistent bytes, like 150 MB . Which one is correct? Why the difference? Are they measuring different things? (Regardless of whether I Transfer an Xcode debug session or start fresh in Instruments, it doesn't seem to make much difference.) The reason

Can ARKit display WKWebview?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 09:36:13
Tried ARKit to show WKWebView and all I got is a page that shows background but no foreground. The page can be scrolled though. I attached Apple web page as screenshot. Here's the code: DispatchQueue.main.async { let webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 640, height: 480)) let request = URLRequest(url: URL(string: "https://www.apple.com")!) webView.load(request) plane.firstMaterial?.diffuse.contents = webView } Does that mean ARKit cannot display web page? I am using iOS 12 beta 2 running ARKit 2. I have also switch off App Transport Security Settings and allow arbitrary load. I