Can't get WorldBound of nodes


I got a problem when test the demo of JME

I can't get WorldBound of Node at first,however got it when updating.

public class TestMilkJmeWrite2 extends SimpleGame{
    Node i=null;
    private static final Logger logger = Logger
    public static void main(String[] args) {
        new TestMilkJmeWrite2().start();

    protected void simpleInitGame() {
        try {
                    new SimpleResourceLocator(TestMilkJmeWrite.class
        } catch (URISyntaxException e1) {
            logger.log(Level.WARNING, "unable to setup texture directory.", e1);

        MilkToJme converter=new MilkToJme();
        URL MSFile=TestMilkJmeWrite.class.getClassLoader().getResource(
        ByteArrayOutputStream BO=new ByteArrayOutputStream();

        try {
        } catch (IOException e) {
  "IO problem writting the file!!!");

        try {
            i=(Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
        } catch (IOException e) {
  "darn exceptions:" + e.getMessage());
        i.setModelBound(new BoundingSphere());

        //create a sphere to compare
        Sphere target;
        target = new Sphere("my sphere", 15, 15, 1);
        target.setModelBound(new BoundingSphere());
        System.out.println("bbb"+i.getWorldBound());//print null
        System.out.println("target"+target.getWorldBound());//print BoundingShpere
    protected void simpleUpdate(){
        System.out.println("bbb"+i.getWorldBound());//print BoundingShpere

Run results:

targetcom.jme.scene.BoundingSphere [Radius: 1.00002 Center: com.jme.math.Vector3f [X=5.9604645E-8, Y=1.4901161E-8, Z=0.0]]
cccom.jme.scene.BoundingSphere [Radius: 3.866392 Center: com.jme.math.Vector3f [X=0.13460055, Y=3.7336762, Z=0.31864902]]
cccom.jme.scene.BoundingSphere [Radius: 4.024398 Center: com.jme.math.Vector3f [X=0.29568264, Y=-0.016815811, Z=0.1889005]]

So,I want to know how can I get WorldBound at first.

This is mostly a guess since I am unfamiliar with what the world bounds even are (I'm a newb here so jME is about 90 still unknown to me), but i am guessing it has something to do with the calls to update the geometry information coming after your call to get world bounds (simpleInitGame is called before UpdateGeometricState in, which extends):

        /** Let derived classes initialize. */


         * Update geometric and rendering information for both the rootNode and
         * fpsNode.
        rootNode.updateGeometricState( 0.0f, true );

Not sure if this will work, but you could try calling the rootNode update stuff above in your simpleInitGame method prior to getting world bounds of an object. 

A somewhat educated guess at least, let me know if it works!

EDIT:  I just added the calls

        rootNode.updateGeometricState( 0.0f, true );

right after you attach the node, but before getworldBounds, and it worked for me.  I guess the real question is why did the sphere work and not the other node?  Thats beyond me :(

Thanks for your reply.

I found it need updateGeometricState before you want getWorldBound.

Just add

  i.updateGeometricState( 0.0f, true );

right after you attach the node, but before getworldBounds, and it worked for me.  I guess the real question is why did the sphere work and not the other node?  Thats beyond me 

Yes,I doubt about that too.