java android libgdx box2d

java - Libgdx NESTED ShapeRenderer no dibuja líneas



android box2d (1)

En el siguiente código, recupero una lista de matrices de vértices (he depurado y de hecho existen) y luego intento renderizarlos en esta disposición de ciclo de nido alojada en el método de renderizado. Por alguna razón, ShapeRenderer no puede conectar todas las líneas si está anidado? ¿Puede alguien decirme qué estoy haciendo mal? Nada se dibuja en la pantalla; No obtengo errores

shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeType.Line); for(int i = 0;i<tmpBodies.size;i++) { if(tmpBodies.get(i).getType().equals(BodyType.DynamicBody) && !tmpBodies.get(i).equals(car.getChassis()) && !tmpBodies.get(i).equals(car.rightWheel)&& !tmpBodies.get(i).equals(car.leftWheel)&& !tmpBodies.get(i).equals(terrain)) // tmpBodies.get(i).getFixtureList().get(0).getShape().equals(Type.Chain) { ChainShape tempShape = new ChainShape(); ArrayList<Vector2> bodyPoints = new ArrayList<Vector2>(); tempShape = (ChainShape)tmpBodies.get(i).getFixtureList() .get(0).getShape(); for(int q=0; q<tempShape.getVertexCount(); q++) { Vector2 linePoints = new Vector2(); tempShape.getVertex(q, linePoints); Vector2 newLinePoints = tmpBodies.get(i).getWorldPoint(linePoints); bodyPoints.add(newLinePoints); } for(int z=0; z<tempShape.getVertexCount()-1; z++) { shapeRenderer.setColor(1, 1, 0, 1); shapeRenderer.line(bodyPoints.get(z).x, bodyPoints.get(z).y, bodyPoints.get(z+1).x, bodyPoints.get(z+1).y); } } }


no si explico bien, es decir, ¿es posible? necesita usar otra matriz4, si usa box2d, por ejemplo, unidades para PPM.

shapeRenderer.setProjectionMatrix(camera.combined);

cambiar por ejemplo:

testMatrix4 Matrix4; //<-- Variable Class.

// en tu código

//Other Code //batch or Camera Matrix testMatrix4 = batch.getProyectionMatrix().cpy() .scale(YOUR_PPM_X, YOUR_PPM_Y, 0); shapeRenderer.setProjectionMatrix(testMatrix4); //Other Code

Nunca hice algo así, pero si no funciona, notifícame, que borro.