Skip to content

Commit

Permalink
Add support for Point and DepthPoint when searching for a default Pose
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Jun 19, 2021
1 parent 5211b71 commit dc71863
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/java/fr/smarquis/ar_toolbox/Nodes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ sealed class Nodes(
val centerY = ar.height / 2F
val hits = ar.arFrame?.hitTest(centerX, centerY)
val planeHitPose = hits?.firstOrNull {
(it.trackable as? Plane)?.isPoseInPolygon(it.hitPose) == true && it.distance <= PLANE_ANCHORING_DISTANCE
when (val trackable = it.trackable) {
is Plane -> trackable.isPoseInPolygon(it.hitPose) && it.distance <= PLANE_ANCHORING_DISTANCE
is DepthPoint, is Point -> it.distance <= DEFAULT_POSE_DISTANCE
else -> false
}
}?.hitPose
if (planeHitPose != null) return planeHitPose
val ray = ar.scene.camera.screenPointToRay(centerX, centerY)
Expand Down

0 comments on commit dc71863

Please sign in to comment.