arkit

How to create a Portal effect in ARKit just using the SceneKit editor?

旧城冷巷雨未停 提交于 2019-11-30 20:39:16
问题 I would like to create a prototype like this one: just using Xcode SceneKit Editor. I found an answer where the room is created programmatically with simple SCNPlane objects and playing around with the rendering order. However, I would like to put together something more elaborated like downloading the 3d model of a room and make it accessible only through the portal. I'm trying to achieve the same effect directly in the Xcode's SceneKit editor converting this part: //a. Create The Left Wall

ARKit 2.0 – Scanning 3D Object and generating 3D Mesh from it

心不动则不痛 提交于 2019-11-30 15:57:18
The iOS 12 application now allows us to create an ARReferenceObject , and using it, can reliably recognize a position and orientation of real-world object. We can also save the finished .arobject file. But : ARReferenceObject contains only the spatial features information needed for ARKit to recognize the real-world object, and is not a displayable 3D reconstruction of that object. sceneView.session.createReferenceObject(transform: simd_float4x4, center: simd_float3, extent: simd_float3) { (ARReferenceObject?, Error?) in // code } func export(to url: URL, previewImage: UIImage?) throws { } Is

ARKit - Projection of ARAnchor to 2D space

大城市里の小女人 提交于 2019-11-30 15:15:21
I am trying to project an ARAnchor to the 2D space but I am facing on an orientation issue... Below my function to project the top left, top right, bottom left, bottom right corner position to 2D space: /// Returns the projection of an `ARImageAnchor` from the 3D world space /// detected by ARKit into the 2D space of a view rendering the scene. /// /// - Parameter from: An Anchor instance for projecting. /// - Returns: An optional `CGRect` corresponding on `ARImageAnchor` projection. internal func projection(from anchor: ARImageAnchor, alignment: ARPlaneAnchor.Alignment, debug: Bool = false) -

ARKIT: Move Object with PanGesture (the right way)

最后都变了- 提交于 2019-11-30 14:53:35
问题 I've been reading plenty of StackOverflow answers on how to move an object by dragging it across the screen. Some use hit tests against .featurePoints some use the gesture translation or just keeping track of the lastPosition of the object. But honestly.. none work the way everyone is expecting it to work. Hit testing against .featurePoints just makes the object jump all around, because you dont always hit a featurepoint when dragging your finger. I dont understand why everyone keeps

ARKit 1.5 how to get the rotation of a vertical plane

人走茶凉 提交于 2019-11-30 14:05:07
I'm experimenting with the vertical plane, and I'm trying to place a node on a wall with the correct rotation based on that vertical plane. here's the ARHitTestResult of the vertical plane that gets tapped: let hitLocation = sceneView.hitTest(touchPoint, types: .existingPlaneUsingExtent) I've tried the following: let hitRotation = hitLocation.first?.worldTransform.columns.2 and let anchor = hitLocation.first?.anchor let hitRotation = anchor?.transform.columns.2 neither one of them seem to work. And this is what I'm hoping to do: boardNode.eulerAngles = SCNVector3((hitRotation?.x)!,

How can I rotate an SCNNode on the axis the camera is looking down?

混江龙づ霸主 提交于 2019-11-30 13:56:08
问题 I've added a UIRotationGestureRecognizer and want to use it rotate a node that the user has selected. Currently, it rotates around z-axis, like so: private var startingRotation: CGFloat = 0 @objc private func handleRotation(_ rotation: UIRotationGestureRecognizer) { guard let node = sceneView.hitTest(rotation.location(in: sceneView), options: nil).first?.node else { return } if rotation.state == .began { startingRotation = CGFloat(node.rotation.w) } node.rotation = SCNVector4(0, 0, 1, -Float

How to create a border for SCNNode to indicate its selection in iOS 11 ARKit-Scenekit?

廉价感情. 提交于 2019-11-30 13:26:37
How to draw a border to highlight a SCNNode and indicate to user that the node is selected? In my project user can place multiple virtual objects and user can select any object anytime. Upon selection i should show the user highlighted 3D object. Is there a way to directly achieve this or draw a border over SCNNode? You need to add a tap gesture recognizer to the sceneView . // add a tap gesture recognizer let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:))) scnView.addGestureRecognizer(tapGesture) Then, handle the tap and highlight the node: @objc func

Technique World tracking performance is being affected by resource constraints

不羁岁月 提交于 2019-11-30 13:01:38
问题 While running an ARKit session with world tracking enabled, the Xcode console shows log messages about (I presume: reduced) tracking performance , even though the AR Session is in Normal tracking state, I am using the device in a well-lit office room with plenty of "features" to detect, and The device moves only subtly. TLDR: I want to understand what can be causing them, what impact they have, and how to prevent them, or (re)act on them when they do occur— NB. not simply hide the error.

ARKIT: Move Object with PanGesture (the right way)

痞子三分冷 提交于 2019-11-30 12:46:44
I've been reading plenty of StackOverflow answers on how to move an object by dragging it across the screen. Some use hit tests against .featurePoints some use the gesture translation or just keeping track of the lastPosition of the object. But honestly.. none work the way everyone is expecting it to work. Hit testing against .featurePoints just makes the object jump all around, because you dont always hit a featurepoint when dragging your finger. I dont understand why everyone keeps suggesting this. Solutions like this one work: Dragging SCNNode in ARKit Using SceneKit But the object doesnt

Get camera field of view in iOS 11 ARKit

僤鯓⒐⒋嵵緔 提交于 2019-11-30 11:08:06
问题 I'm using a ARSCNView from ARKit to display live a video feed from the camera on the iPad. I have the ARSCNView object setup exactly as Xcode's Augmented Reality App template. I was wondering if there is a way to get the field of view of the camera? @IBOutlet var sceneView: ARSCNView! func start() { sceneView.delegate = self sceneView.session.run(ARWorldTrackingConfiguration()) // Retrieve camera FOV here } 回答1: There are a couple of ways to go here, and a possible false start to beware of.