As in the interactive java3d tutorials, I have created an interactive object
viewer using the mouse interactive classes (e.g.:
MouseRotate myMouseRotate = new MouseRotate();
myMouseRotate.setTransformGroup(objTransform);
myMouseRotate.setSchedulingBounds(new BoundingSphere());
objRoot.addChild(myMouseRotate);
MouseTranslate myMouseTranslate = new MouseTranslate();
myMouseTranslate.setTransformGroup(objTransform);
myMouseTranslate.setSchedulingBounds(new BoundingSphere());
objRoot.addChild(myMouseTranslate);
MouseZoom myMouseZoom = new MouseZoom();
myMouseZoom.setTransformGroup(objTransform);
myMouseZoom.setSchedulingBounds(new BoundingSphere());
objRoot.addChild(myMouseZoom);
)
I center my objects on the origin of objRoot so that rotations etc. occur on
the spot and don't swing the object wildly through space but... given that
the objects can be of very differing scales I am not sure how to arrange so
that the object fills the screen at start up.
The code:
// method returns a branchgroup scene to view the objRoot object
BranchGroup scene = createSceneGraph(filename);
// SimpleUniverse is a Convenience Utility class
SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
simpleU.getViewingPlatform().setNominalViewingTransform();
// added to ensure objects wouldn't get clipped in background so soon
canvas3D.getView().setBackClipDistance(1000.00d);
simpleU.addBranchGraph(scene);
Creates a view of the object in a universe space but the
setNominalViewingTransform() usually isn't far enough away from the objects
to allow a good view.
Given that I know the objects bounding box, how do I use this information to
set an initial zoom factor or create an initial viewing platform transfrom
to get a good view of the whole object?
I hope this isn't too confusing.
John
===========================================================================
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".