hello
how can i get latitude / longitude when i touch a virtual ground
i added touchlistener to arsceneview
arSceneView .getScene() .setOnTouchListener( (HitTestResult hitTestResult, MotionEvent event) -> { return gestureDetector.onTouchEvent(event); });
my gesture detector
` // Set up a tap gesture detector.
gestureDetector =
new GestureDetector(
this,
new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapUp(MotionEvent e) {
onSingleTap(e);
return true;
}
@Override
public boolean onDown(MotionEvent e) {
return true;
}
});`
my onsingletap
`private void onSingleTap(MotionEvent tap) {
Log.d(TAG,"single tap X1");
float centerX = tap.getX();
float centerY = tap.getY();
Log.d(TAG,"centerX : "+centerX);
Log.d(TAG,"centerY : "+centerY);
Frame frame = arSceneView.getArFrame();
if (frame != null) {
Log.d(TAG,"single tap X2");
Collection<Plane> planes = frame.getUpdatedTrackables(Plane.class);
for (Plane plane : planes) {
Log.d(TAG,"liste plan : "+plane.getType());
if (plane.getTrackingState() == TrackingState.TRACKING && plane.getType() == Plane.Type.HORIZONTAL_UPWARD_FACING) {
List<HitResult> hitResults = frame.hitTest(centerX, centerY);
int count_hit = hitResults.size();
Log.d(TAG,"count_hit : "+count_hit);
if (hitResults.size() > 0) {
Anchor Nanchor = hitResults.get(0).createAnchor(); // how can i have lat / lng coordinate here ? thanks ?
float[] Xaxis = Nanchor.getPose().getXAxis();
Log.d(TAG,"Xaxis : "+Xaxis[0]);
// return hitResults.get(0).createAnchor();
}
}
}
}
}`
hello how can i get latitude / longitude when i touch a virtual ground
i added touchlistener to arsceneview
arSceneView .getScene() .setOnTouchListener( (HitTestResult hitTestResult, MotionEvent event) -> { return gestureDetector.onTouchEvent(event); });
my gesture detector ` // Set up a tap gesture detector. gestureDetector = new GestureDetector( this, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { onSingleTap(e); return true; }my onsingletap
`private void onSingleTap(MotionEvent tap) { Log.d(TAG,"single tap X1");
thanks