How to place a 3D object above the other one using ARKit?

917 views Asked by At

I am working on a AR based POC using the sample given by Apple.

Is there a way to place a 3D object above another 3D object in SceneKit?

For example I have placed a table above which I have to place something else like a flower vase. How to achieve this?

Because as far as I know, ARKit is detecting only floor surface and if I try to place the flower vase over the already kept table, it is placing it under the table overlapping the existing 3D object. Is this doable?

1

There are 1 answers

0
Vasilii Muravev On BEST ANSWER

When you're making hitTest, you could check if there's any nodes:

let results = sceneView.hitTest(checkLocation, options: [.boundingBoxOnly: true])
guard let node = results.first?.node else { return }

Then you can place your new node as child node for touched node.