Hi java3d people,
I'm using the ViewerAvatar utility class. I'm using the VRML loader to load
the avatar geometry for the avatar, and I'm trying to upcast(I think that's
the direction?) from a BranchGroup to a ViewerAvatar. First off, can you
do this?
My code looks like this:
SimpleUniverse u;
try{
vScene = vLoader.load(url);
}
catch (FileNotFoundException e)
{
}
// I get the branch group from the scene object
BranchGroup avatar = vScene.getSceneGroup();
Viewer vwr = u.getViewer();
// then I try to cast it to a vieweravatar object
vwr.setAvatar((ViewerAvatar)avatar);
and I get a java.lang.ClassCastException.
Does java not let you do this kind of casting? I suppose it is inherently
dangerous, but there is nothing different about the structure of
ViewerAvatar from BranchGroup. Do I have to manually write a routine to
copy all of the children to the new node? I'm a little confused by what the
would involved. I realize that there's a duplicateNode() function and a
copyNode() function. I don't understand the difference really. Any help
would be appreciated.
Thanks,
Doug
===========================================================================
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".