Java3d 重置到新场景

发布于 2024-08-10 06:02:58 字数 120 浏览 1 评论 0原文

我正在用 Java3D 开发一个游戏。我从文件中读取了所有级别信息并且工作正常。但现在我想通过从不同的文件读取数据来重新初始化场景。

如何重置场景?

我应该销毁整个canvas3D和宇宙对象吗?

I'm working on a game in Java3D. I read all my level info from a file and it works fine. But now I want to re-initialize the scene from reading data from a different file.

How do I reset the scene?

Should I just destroy the whole canvas3D and universe objects?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月野兔 2024-08-17 06:02:58

谢谢 Mikeb,你让我走上了正轨。

我想通了。您需要分离分支组。

像这样:

if (sceneBG != null) {
   sceneBG.detach();
}
sceneBG = new BranchGroup();
sceneBG.setCapability(BranchGroup.ALLOW_DETACH); 

Thanks Mikeb, you put me on the right track.

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); 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文