Clearing then reloading a new scene

View: New views
4 Messages — Rating Filter:   Alert me  

Clearing then reloading a new scene

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

I'm fairly new to Java3D.

I have a maze game which works well so far. I create a universe and add a BranchGroup to it and then fill in the obstacles by reading from a 2D  array.

Now I'd like to be able to load a new level.  How can I clear this scene and allow a new maze to be rendered?

So I create a SimpleUniverse, instantiate a new BranchGroup, and then add a textured floor, sky and then add the obstacles.

It doesn't seem to work just re-instantiating a new BranchGroup again.
[Message sent by forum member 'sproketboy' (sproket@...)]

http://forums.java.net/jive/thread.jspa?messageID=370561

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Clearing then reloading a new scene

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I figured it out. You need to detach the branchgroup.

Like this:

        if (sceneBG != null) {
            sceneBG.detach();
        }
        sceneBG = new BranchGroup();
        sceneBG.setCapability(BranchGroup.ALLOW_DETACH);
[Message sent by forum member 'sproketboy' (sproket@...)]

http://forums.java.net/jive/thread.jspa?messageID=370701

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Clearing then reloading a new scene

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Switch also helps, if you plan to use same sub-graph later.
[Message sent by forum member 'zesharp' (zando.silva@...)]

http://forums.java.net/jive/thread.jspa?messageID=370715

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Clearing then reloading a new scene

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks. I didn't know about Switch.
[Message sent by forum member 'sproketboy' (sproket@...)]

http://forums.java.net/jive/thread.jspa?messageID=370771

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...