I would like to render a model in my viewport but the code I currently have isn’t working. Sorry if this question is somwhere already or the answer on the wiki, but I haven’t been able to find it. Sorry for the sloppy code!
[java]
/** Must add a light to make the lit object visible! */
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(1, 0, -2).normalizeLocal());
sun.setColor(ColorRGBA.White);
gunNode.addLight(sun);
Spatial gun = assetManager.loadModel("Models/STG44/stg44.blend");
// gun.scale(0.05f, 0.05f, 0.05f);
// gun.rotate(0.0f, -3.0f, 0.0f);
gun.setLocalTranslation(1, 3, 1);
gunNode.attachChild(gun);
Camera cam2 = cam.clone();
cam2.setViewPort(5f, 1f, 0f, 0.5f);
cam2.setLocation(new Vector3f(-0.10947256f, 1.5760219f, 4.81758f));
cam2.setRotation(new Quaternion(0.0010108891f, 0.99857414f, -0.04928594f, 0.020481428f));
view2 = renderManager.createMainView("Bottom Right", cam2);
view2.setClearFlags(true, true, true);
view2.attachScene(gunNode);
viewPort.setBackgroundColor(ColorRGBA.White);
gunNode.updateGeometricState();[/java]