You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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();
}
}
}
}
}`
thanks
The text was updated successfully, but these errors were encountered:
openmotion
changed the title
click on ground and add object
touch the scene, get lat/long position and add new object with this coordinates
Jan 18, 2020
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
The text was updated successfully, but these errors were encountered: