Toggle the branchGroup's visiblity ..

I want to toggle some BranchGroups when some condition occurs … I have tried SWitch Class but :-[

And I have 2 views and the their multiple Canvases & cameras and the visibilty toggle could result 1 view seeing the Brnach Group while the other unable to see it …
Could it be done by Switch as well…
Any kind of help is really appreciated

Hammad

I’m not sure to understand it correctly.
Do you want to toggle branchgroups or visibility?

In both cases, i suppose you have 2 cloned universes, do you?
If Switch doesn’t work, maybe you can use detach() and addChild(…) to toggle visibility.


root1.setCapability(ALLOW_CHILDREN_EXTEND);
root2.setCapability(ALLOW_CHILDREN_EXTEND);
bg1.setCapability(ALLOW_DETACH);
bg2.setCapability(ALLOW_DETACH);

bg1.detach(); //the first becomes invisible
root2.addChild(bg2); //the second becomes visible

I understand your question, but I do not know any way to solve it.

Normally when something is set not visible it cannot be seen from all your viewplatforms, except maybe for LOD based switching. Perhaps you can try to switch it on in prerender() for one canvas and next off in the other canvas prerender() or something like that…

Regards
Nikolai

You could use a ViewSpecificGroup (introduced in 1.3). This allows you to control which View(s) a group is rendered to.