I’m starting a little project in Java3D and I’m trying to get a better understanding of how setSchedulingBounds() works.
To give a very simple example, consider the following lines from HelloJava3Dd.java:
// a bounding sphere specifies a region a behavior is active
// create a sphere centered at the origin with radius of 1
BoundingSphere bounds = new BoundingSphere();
rotator.setSchedulingBounds(bounds);
objSpin.addChild(rotator);
No problem so far. ColorCube rotates fine.
Now change:
BoundingSphere bounds = new BoundingSphere();
to
new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 1.0);
Still OK, as I understand things, this is pretty much the same as the empty constructor. ColorCube still rotates fine.
Now, if I comment out the following line, the ColorCube won’t rotate. Also as expected.
rotator.setSchedulingBounds(bounds);
Here’s my problem/question:
If I change the default position of the bounding sphere or give it a really small radius, the ColorCube still rotates fine. Should the bounding sphere intersect the ColorCube at any (however small) position or at all positions? I’m failing to see a tight correlation between the location/size of the bounding sphere and the rotation.
For a ColorCube constructed with a scale of 0.4, the rotation will work for the first bounding sphere below, but not for the second.
This works:
BoundingSphere bounds = new BoundingSphere(new Point3d(30.0, 30.0, 30.0), 0.0001);
This doesn’t:
BoundingSphere bounds = new BoundingSphere(new Point3d(40.0, 40.0, 40.0), 0.0001);
Thanks for your help!