From cb1920eaff01ed300e5dac3628cf55cbbe07f9b8 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Thu, 14 Feb 2013 22:53:34 +0000 Subject: [PATCH] - cleanup state detaching in WoI git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10410 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/test/jme3test/games/WorldOfInception.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/engine/src/test/jme3test/games/WorldOfInception.java b/engine/src/test/jme3test/games/WorldOfInception.java index c3e3c135d..71366e137 100644 --- a/engine/src/test/jme3test/games/WorldOfInception.java +++ b/engine/src/test/jme3test/games/WorldOfInception.java @@ -260,12 +260,10 @@ public class WorldOfInception extends SimpleApplication implements AnalogListene return; } else if (currentActiveChild != null && currentActiveChild.getPositionInParent().equals(vector3f)) { //TODO: doing this here causes problems when close to multiple pois - logger.log(Level.INFO, "Detach child {0}", currentActiveChild); rootNode.getChild(i).setCullHint(Spatial.CullHint.Inherit); - stateManager.detach(currentActiveChild); - currentActiveChild = null; } } + checkActiveChild(null); curScaleAmount = 0; rootNode.setLocalScale(1); rootNode.setLocalTranslation(playerPos.negate()); @@ -276,6 +274,14 @@ public class WorldOfInception extends SimpleApplication implements AnalogListene private void checkActiveChild(Vector3f vector3f) { AppStateManager stateManager = application.getStateManager(); + if(vector3f == null){ + if(currentActiveChild != null){ + logger.log(Level.INFO, "Detach child {0}", currentActiveChild); + stateManager.detach(currentActiveChild); + currentActiveChild = null; + } + return; + } if (currentActiveChild == null) { currentActiveChild = new InceptionLevel(this, vector3f); stateManager.attach(currentActiveChild);