Hi all

I have got an appliation that I import VRML shapes and add them to the scene
at run time.  One of the issues I have is that when the user moves the
starting shape it is tricky for them just to manipluate the shape back to the
starting position.  What I want to do is place a button on the swing panel
that resets the scene back to it's starting posistion and rotation etc.

The problem I have is that I don't seam to be able to change the view of my
scene I have lood at the Selman book and tried to include some parts of the
code but it all has no effect I am proberly constructing it wrong so if
someone could point out what I have done wrong I would "luv it"

canvas          = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
simpleUniverse          = new SimpleUniverse(canvas);
ViewPlatform vp         = new ViewPlatform();
TransformGroup viewTG   = new TransformGroup();
Transform3D viewT3d     = new Transform3D();
Transform3D eyeT3d      = new Transform3D();
View view               = new View();
PhysicalBody pb         = new PhysicalBody();
PhysicalEnvironment pe  = new PhysicalEnvironment();
view.setPhysicalBody(pb);
view.setPhysicalEnvironment(pe);
//setting up TransformGroup for view
viewT3d.setTranslation(new Vector3d(0.0,0.0,10.0));
//set up a default viewing platform
view.attachViewPlatform(vp);
view.setBackClipDistance( 300 );
view.setFrontClipDistance( 0.3 );
// Background color
worldBounds = new BoundingSphere(new Point3d(),100.0);
addLighting(worldBounds);
back.setApplicationBounds( worldBounds );
back.setCapability(Background.ALLOW_COLOR_WRITE);
back.setColor( new Color3f(0.7f, 0.7f, 0.95f ));
/*
Point3d centre = new Point3d();
worldBounds.getCenter(centre);
double radius = worldBounds.getRadius();
Vector3d temp = new Vector3d(centre);
viewT3d.set(temp);
System.out.println("temp = "+temp);
double eyeDist = 1.4*radius/ Math.tan(Math.toRadians(40)/2.0);
temp.x = 0.0;
temp.y = 0.0;
temp.z = eyeDist;
eyeT3d.set(temp);
viewT3d.mul(eyeT3d);
*/
//create scene
canvas.setCursor(new Cursor(Cursor.HAND_CURSOR));
BranchGroup root = new BranchGroup();
BranchGroup shape = new BranchGroup();
shape = (BranchGroup)getScene();
//add all groups to root node
viewTG.addChild(vp);
viewTG.setTransform(viewT3d);
root.addChild(viewTG);
root.addChild(shape);
root.compile();
SimpleUniverse.addBranchGraph(root);

C YA Phil Colbert :)

Philip J Colbert
Software Engineer
RCID, Bruce Building
University of Newcastle Upon Tyne
NE1 7RU
Phone 0191-2225306
Fax 0191-2225833
This e-mail, including any attached files, may contain confidential and privileged 
information for the sole use of the intended recipient(s). If you are not the intended 
recipient, please note that any circulation or copying of this e-mail is strictly 
prohibited. If you have received this e-mail in error please contact the sender by 
reply e-mail and delete all copies of this message.

The RCID makes every effort to ensure that this e-mail and any attachments are sent 
virus free. However it is the responsibility of the recipient to perform any checks 
they deem necessary.

===========================================================================
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