sceneview-android icon indicating copy to clipboard operation
sceneview-android copied to clipboard

Can't call getWorldPosition

Open dhatriparakal opened this issue 7 months ago • 0 comments

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?

dhatriparakal avatar Jul 10 '24 13:07 dhatriparakal