** Seems I didn't send a copy of this to the list. Sorry about that.

Mona,

You should be able to put the objects in question under a Switch node. When
you detect which object your user wants to turn off, figure out which switch
node it's under and turn the switch node off with the following (assuming
your Switch node is called switchNode):

switchNode.setWhichChild(Switch.CHILD_NONE);

Turn it back on with:

switchNode.setWhichChild(Switch.CHILD_ALL);

Just make sure your switch node has the following capabilities set:

Switch.ALLOW_SWITCH_WRITE

If you don't want to have one switch node per object, you can store all your
objects under one switch node and use the switch node's childMask to set
which node(s) is(are) visible. Chances are this is much more efficient (can
anyone confirm/contradict this? what is the cost per switch node?) but it
is, IMHO, slightly more confusing.

-Jean Laleuf
[EMAIL PROTECTED]


-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of Mona Wong
Sent: Wednesday, May 02, 2001 6:44 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] making an object(s) "disappear"


Hi:

        I'm sure this must be documented somewhere but I have not been able
to
find the answer, especially with j3d.org down ...

        I have several 3d objects in my canvas and I want to allow the user
to
turn off display of any object(s) s/he chooses.  I can see several ways of
doing
this ...

        1.  Make each object a BranchGroup and detach it when requested by
the
user
        2.  Change the color or the object to the background color so the
user
will no longer "see" it
        3.  "Detach" the object from the BranchGroup.

        Does anyone have any input on what is the proper or best method?  If
#3
is the answer, could someone point me to some docs on how to do this?

Thanks,

Mona

==================================================================
Mona Wong
National Center for Microscopy and Imaging Research
University of California, San Diego
http://ncmir.ucsd.edu/

"The truth shall set you free, but first it will piss you off"
                                A Landmark instructor
==================================================================

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to