I was wondering if someone was able to determine the vertical planes in front of the device in real time using the ARCore SDK.
I managed to achieve a decent result by defining a wall using the linear equation:
z = Multiplier * x + Constant (For every y)
in the βfor every yβ comment, I meant that I ignore the y axis (looking at the wall from above as a 2d-image of the room) to calculate the line that defines the wall.
A multiplier is a rotation between points:
let angleDeg = Float((360 - angle + 360) % 360) * Float.pi / 180.0;
All calculations:
let angle: Int = Int((atan2(pointA.z - pointB.z, pointA.x - pointB.x) * 180) / Float.pi) % 360 yRotation = Float((360 - angle + 360) % 360) * Float.pi / 180.0 if pointA.x == pointB.x { multiplier = Float.infinity } else { multiplier = (pointA.z - pointB.z) / (pointA.x - pointB.x) } constant = pointA.z - multiplier * pointA.x }
Now I start this calculation while the user walks around and displays a lot of dots.
The results are good, but not as accurate as detecting the horizontal plane of ARCore.
java kotlin augmented-reality arcore
Nativ
source share