1

I recently started working on java3D. Currently I am working on a java3D racing game. I just wanted to know is it possible to add objects (i.e. scenegraph nodes nodes) e.g. spehere, box, etc. to a scene graph which has been compiled.

If i want to add an object onto a graph on a keyPress event, or on a timing event how can it be done?

4

1 回答 1

4

是的,您可以从 Universe 场景图中动态添加和删除 BranchGroup。

通常,每个 BranchGroup 都在内部编译为单个网格,以加快渲染速度。

因此,您可以使您的球体、汽车网格等成为 BranchGroup 的子项,然后将该 BranchGroup 添加为主 BranchGroup 的子项。

您可能还需要设置 MyBranchGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND); 允许添加孩子。

于 2012-04-30T09:49:05.527 回答