Hi everyone,
I've got a scene set up, which is relatively simple.
There's one root Node with a lot of SwitchNodes attached to it. The SwitchNode changes dependant on the distance from the camera. The SwitchNode contains several SharedNodes which it switches between.
Somehow the models attached to these nodes are being culled before they have completely left the frustrum. Am I missing a setting that defines whether a node is culled at FRUSTUM_INTERSECTS instead of FRUSTRUM_OUTSIDE?
I'm updating the worldBound at every switch, so I doubt that is the reason.
Thanks,
JWar
Probably your camera setup is wrong - how did you configure it?
I am extending DebugGameState, so the camera is set up as it is there. The only difference is that I have changed the frustrum farplane to 2000f instead of 1000f.
Camera setup in DebugGameState looks ok on the first glance. Try commenting out your camera code. If that does not help try to make a minimal testcase. Either your frustum or your boundings are inverted, I guess.
I have a very simple setup here. Try slowly rotating away from the cube. You'll see it is culled before it had completely left the view.
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.math.Vector3f;
import com.jme.scene.Spatial;
import com.jme.scene.shape.Box;
/**
* @author JWar
*
*/
public class TestImposter extends SimpleGame {
/**
* @param args
*/
public static void main(String[] args) {
TestImposter app = new TestImposter();
app.setDialogBehaviour(TestImposter.FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
app.start();
}
/*
* (non-Javadoc)
*
* @see com.jme.app.BaseSimpleGame#simpleInitGame()
*/
@Override
protected void simpleInitGame() {
Spatial model = new Box("b", Vector3f.ZERO, 5f, 5f, 5f);
model.setModelBound(new BoundingBox());
model.updateWorldBound();
rootNode.attachChild(model);
rootNode.updateGeometricState(0, false);
}
}
Sorry for wasting your time. I kept reading over the mistake I kept making everywhere.
.updateWorldBound();
Should be
updateModelBound();
Thanks a bunch anyway.