Norbert Dec wrote:
>Hi!
>
>Is it possible to set the view so that it would automatically compute the
>bounds of the object and put it in the center of the screen?
>I have load one object with OBJLoader (VirtualUniverse).
>
>I tried to get the "View-Point" with:
>
>public Vector3f getViewPoint(){
>
> sceneBounds = applet.getboundingSphere();
>
> Point3d center = new Point3d();
> sceneBounds.getCenter(center);
> double radius = sceneBounds.getRadius();
> Vector3f temp = new Vector3f();
>
> view = applet.getView();
>
> float eyeDist = 1.4f * (float)radius /
> (float)Math.tan(view.getFieldOfView()/ 2.0f);
>
>
> temp.x =(float)center.x;
> temp.y = (float)center.y;
>
>
> temp.z = eyeDist;
> return temp;
> }
>
>Could some please tell me what I am doing wrong!!
>
Hi,
I recognize your problem, I just struggled with something similiar when
trying to center a Shape3D object on the screen.
My problem was that I was using the wrong bounds for my object, causing the
eye distance to become much to large. So your problem could be that you use
the sceneBounds of the applet, not the object itself.
The following code may be used to find the bounds of any object derived
from Node:
System.out.println("Is bounds auto computed = " +
nodeObject.getBoundsAutoCompute());
System.out.println("bounds = " + nodeObject.getBounds());
Hope this is of any help.
Roger Berggren
===========================================================================
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".