@Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
        this.app = app;
        this.rm = app.getRenderManager();
        this.assetManager = app.getAssetManager();
        setupMaterials(app);
        physicsDebugRootNode.setCullHint(Spatial.CullHint.Never);

        if (isVr()) {
            /* This is a less good solution than the non-vr version (as the debug shapes can be obscured by the regular
            * geometry), however it is the best possible as VR does not currently support multiple viewports per eye */
            VRAppState vrAppState = stateManager.getState(VRAppState.ID, VRAppState.class);
            vrAppState.getLeftViewPort().attachScene(physicsDebugRootNode);
            vrAppState.getRightViewPort().attachScene(physicsDebugRootNode);
        } else {
            viewPort = rm.createMainView("Physics Debug Overlay", app.getCamera());
            viewPort.setClearFlags(false, true, false);
            viewPort.attachScene(physicsDebugRootNode);
        }
    }
Initialize this state prior to its 1st update. Should be invoked only by
a subclass or by the AppStateManager.

@param stateManager the manager for this state (not null)
@param app the application which owns this state (not null)
jme3-jbullet/src/main/java/com/jme3/bullet/debug/BulletDebugAppState.java