protected void initScene() { RajLog.systemInformation(); setFrameRate(60); LoaderGCode gCodeParser = new LoaderGCode( getResources(), getTextureManager(), R.raw.calibrationcube_404020_psm_pla35); try { Object3D gCode3D = gCodeParser.parse().getParsedObject(); if (null != gCode3D) { Line3D firstPos = (Line3D) gCode3D.getChildAt(0); Line3D lastPos = null; if (gCode3D.getNumChildren() < 2) { lastPos = firstPos; } else { lastPos = (Line3D) gCode3D.getChildAt(gCode3D.getNumChildren() - 1); } getCurrentCamera().setPosition(0, 0, lastPos.getPoint(0).z + 150); getCurrentCamera().setLookAt(0, 0, 0); float scaleFactor = 0.7f; gCode3D.setScale(scaleFactor); gCode3D.setPosition( -firstPos.getPoint(0).x * scaleFactor, -firstPos.getPoint(0).y * scaleFactor, 0); gCode3D.setRotation(360 - 35, 0, 360 - 15); Material mat = new Material(); for (int i = 0; i < gCode3D.getNumChildren(); i++) { gCode3D.getChildAt(i).setMaterial(mat); } addChild(gCode3D); } } catch (Exception e) { RajLog.e( new StringBuilder() .append("error init'ing gcode GL scene:\n") .append(Log.getStackTraceString(e)) .toString()); } }