Raj
Raj

Reputation: 495

ARKit: How to detect only Horizontal floor excluding obstacles

I am developing horizontal plane detection application using ARKit. It seems to be working fine. Once floor is detected I am trying to place SCNPlane 2meter Hight and 2meter width horizontally from the centre point(detected floor). It is also working fine when floor is empty. If floor has some objects(obstacles like furniture) then SCNPlane is being placed over the object instead of the floor(under the object). How to detect only Horizontal floor excluding the objects. please guide me. thanks

Upvotes: 1

Views: 880

Answers (1)

Vollan
Vollan

Reputation: 1915

When you are searching and have found the floor the ARKit will put out a grid, normally people use some kind of grid image to display this, but some don't want to show it. Once the grid has placed you place a SCNPlane, which i assume has an physical body as you say it falls towards the floor / furniture?

You can do this in 3 ways:

  • You can to stop the worldTrackingConfiguration once the floor has been found.
  • You can once the floor has been found, fetch that Y-position and bind every object to fall towards that Y-position.
  • I guess you could check if the Y-position of the new detection overlaps with the floor detection, then it's fine else it's not. (I have not tested this one)

Upvotes: 1

Related Questions