Hi, i’m running a simulation that constantly updates the traffic light status during runtime.
however, after about 1 minute of running, the traffic lights disappear and in sequence of their creation. not too sure what the problem is as the traffic lights are able to change their statuses successfully and update the corresponding model.
code:
Spatial TLRN = null;
Spatial TLRS = null;
Spatial TLRE = null;
Spatial TLRW = null;
assetManager = JmeSystem.newAssetManager(Thread.currentThread().getContextClassLoader().getResource(“com/jme3/asset/Desktop.cfg”));
if (this.status[0] == true) { // green light for NS
TLRE = assetManager.loadModel(“Models/trafficG/trafficLightG.j3o”);
TLRW = assetManager.loadModel(“Models/trafficG/trafficLightG.j3o”);
}
else { // red light for NS
TLRE = assetManager.loadModel(“Models/trafficR/trafficLightR.j3o”);
TLRW = assetManager.loadModel(“Models/trafficR/trafficLightR.j3o”);
}
TLRE.scale(0.1f, 0.1f, 0.1f);
TLRE.setLocalTranslation(0, 0, -1);
lightNode.attachChild(TLRE);
TLRW.scale(0.1f, 0.1f, 0.1f);
TLRW.setLocalTranslation(0, 0, 1);
lightNode.attachChild(TLRW);
md.loadNode(lightNode);
// this method is called repeatedly when i want to change my traffic light status.
// the method loadNode just attaches the lightNode onto rootNode.
error received when my objects disappear:
Apr 28, 2011 4:51:38 PM com.jme3.scene.Node attachChild
INFO: Child (Models/trafficG/trafficLightG-scene_node) attached to this node (null)
Apr 28, 2011 4:51:38 PM com.jme3.scene.Node attachChild
INFO: Child (Models/trafficR/trafficLightR-scene_node) attached to this node (null)
Apr 28, 2011 4:51:38 PM com.jme3.scene.Node attachChild
INFO: Child (Models/trafficR/trafficLightR-scene_node) attached to this node (null)
kindly advise. thank you!