BoundingSphere is emty
I am having a problem with getting the BoundingSphere of an loaded 3d object.
During application start i immediatly load a file into java3d and place the view that i can see the geometry.
For that task i need the BoundingSphere of that object to compute the view position.
scene = loader.load(filename);
BranchGroup sceneGroup = scene.getSceneGroup();
BoundingSphere sceneBounds = (BoundingSphere)sceneGroup.getBounds();
Transform3D transform3d = new Transform3D();
Transform3D transform3d1 = new Transform3D();
Point3d point3d = new Point3d();
double d = point3d.distance(new Point3d());
Vector3d vector3d = new Vector3d(point3d);
double d1 = (10D * d) / Math.tan(view.getFieldOfView() / 2D);
vector3d.x = 0.0D;
vector3d.y = 0.0D;
vector3d.z = d1;
The problem is that during application start and directly after loading the file java3d doesn't seem to be ready computing the boundingsphere.
If i put a "Thread.sleep(x)" in front of the "sceneBounds = (BoundingSphere)sceneRoot.getBounds()"
it works, but this can't be the solution.
If i use the application in applet form even this Thread.sleep workaround doesn't help.