if (frame.getCamera().getTrackingState() == TrackingState.TRACKING && anchorsts && !placed) {
Session session = arFragment.getArSceneView().getSession();
String type = "fwd";
int distance = 0;
int nextPoint = 1;
String[] positions = {"u", "u","r", "r","r", "r", "r", "r", "r", "r"};
if (turnStatus == null){
turnStatus = positions[distance];
Log.i("turnStatus", "pos " + positions[distance]);
}
float[] rotation = {0, 0, 0, 0};
do {
if (positions[distance].equals("u")) {
turnStatus = "u";
placeNav(session, new float[]{dx, dy, dz}, rotation, positions[distance]);
if (!turnStatus.equals(positions[nextPoint])) {
if (positions[nextPoint].equals("r")) {
turnDistance = distance;
}
}
} else if (positions[distance].equals("r")){
turnDistance ++;
turnStatus = "r";
placeNav(session, new float[]{turnDistance, -1.5f, -turnDistance}, rotation, positions[distance]);
if (!turnStatus.equals(positions[nextPoint])) {
if (positions[nextPoint].equals("u")) {
}
}
}
distance++;
nextPoint ++;
} while (distance <9);
placed = true; //to place the arrow just once.
}
private void placeNav(Session session, float[] pos, float[] rotation, String type) {
AnchorNode anchorNode = new AnchorNode(anchor);
currentAnchorNode = anchorNode;
anchorNode.setParent(arFragment.getArSceneView().getScene());
Node arrow = new Node();
arrow.setParent(anchorNode);
if (type.equals("u"))
arrow.setRenderable(andyRenderable);
else if (type.equals("r"))
arrow.setRenderable(andyRenderable);
}
the above code is used to render a loop of renderables into scene. I need to display only first two renderables and display next renderables while user is moving forward. here the positions array isnused to render objects into scene. Please to help me to implement this