// Assume canvas3D is already created
SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
TransformGroup VPTG = new TransformGroup();
VPTG =
simpleU.getViewingPlatform().getMultiTransformGroup().getTransformGroup(0);
Transform3D VPT3D = new Transform3D();
// The third value in the Vector3f is the distance along the Z axis
that you will need to set
VPT3D.setTranslation(new Vector3f(0.0f, 0.0f, 50.0f));
VPTG.setTransform(VPT3D);
// You may need to do this
// Use this to keep objects from disappearing as you move away from it
Viewer VPViewer = simpleU.getViewer();
View VPView = new View();
VPView = VPViewer.getView();
VPView.setBackClipDistance(10000.0);
There is also a set nominal viewing platform method. I don't remember the
exact name but this moves you back so that you can see the whole scene but
the method above allows you to explicitly set the viewer's position.
At 01:14 PM 09/29/2000 +0200, you wrote:
>Hello,
>
>I'm creating an application where I try to load a .wrl file. The file loads
>in but I don't see him on the screen, after I zoom out for a very long time
>the file comes visible. I know that the viewpoint's not set well but I don't
>know how to fix it.
>
>Here is the code that I'm using to set my viewpoint:
>
>VrmlScene scene;
>VrmlLoader loader = new VrmlLoader();
>scene = (VrmlScene) loader.load(url);
>Vector3d offset = new Vector3d();
>
>Transform3D objTrans = new Transform3D();
>BranchGroup sceneGroup = scene.getSceneGroup();
>sceneGroup.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
>sceneGroup.setCapability(BranchGroup.ALLOW_BOUNDS_WRITE);
>
>// create the setup viewpoint
>BoundingSphere sceneBounds = new BoundingSphere(sceneGroup.getBounds());
>
>double radius = sceneBounds.getRadius();
>
>Point3d center = new Point3d();
>sceneBounds.getCenter(center);
>
>offset.x = center.x;
>offset.y = center.y;
>offset.z = center.z;
>
>objTrans.set(radius, offset);
>//viewTransformGroup is the transformGroup to set the viewplatform
>viewTransformGroup.setTransform(objTrans);
>
>Can anyone help me out, please?
>
>---------------------------------------------------------------------
>Jochen Vande Walle
>Software Developer
>
>QMatics
>Bruggesteenweg 112
>8830 Hooglede - België
>---------------------------------------------------------------------
>Tel. +32 51 272 400
>Fax. +32 51 272 401
>---------------------------------------------------------------------
>mailto:[EMAIL PROTECTED]
>
>===========================================================================
>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".
***********************************************************************
Eric Reiss - http://www.sigda.acm.org/Eric/
Email: [EMAIL PROTECTED]
SIGDA Internet Server Manager - http://www.sigda.acm.org/
Assistant Systems Manager - School of Engineering
University of Pittsburgh
***********************************************************************
===========================================================================
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".