sceneview-android
sceneview-android copied to clipboard
Can't call getWorldPosition
I'm trying to take measurements with AR. So far I'm using the coordinates of a polygon from a hitTest to calculate lengths; however, those coordinates are based on the length on screen and not the distance in real life.
val hitResults = frame?.hitTest(motionEvent.x, motionEvent.y)
val hitResult = hitResults?.firstOrNull { hit ->
hit.trackable is Plane && (hit.trackable as Plane).isPoseInPolygon(hit.hitPose)
}
val world = hit.trackable.getWorldPosition()
I want to use getWorldPosition()
to get the real-world length, but hitResult.trackable.getWorldPosition()
doesn't work - can someone please help me with this?