2323 * Press 'p' to print the current node rate.
2424 * Press 'm' to change the boid visual mode.
2525 * Press 'v' to toggle boids' wall skipping.
26- * Press 's' to call scene.fit(1 ).
26+ * Press 's' to call scene.fit(1000 ).
2727 */
2828
2929import nub.primitives.* ;
@@ -44,21 +44,18 @@ Node avatar;
4444void setup () {
4545 size (1000 , 700 , P3D );
4646 scene = new Scene (this , new Vector (flockWidth / 2 , flockHeight / 2 , flockDepth / 2 ), 800 );
47- scene. fit();
4847 // create and fill the list of boids
4948 flock = new ArrayList ();
5049 for (int i = 0 ; i < initBoidNum; i++ )
5150 flock. add(new Boid (new Vector (flockWidth / 2 , flockHeight / 2 , flockDepth / 2 )));
5251}
5352
5453void draw () {
55- scene. openContext();
5654 background (10 , 50 , 25 );
5755 ambientLight (128 , 128 , 128 );
5856 directionalLight (255 , 255 , 255 , 0 , 1 , - 100 );
5957 walls();
6058 scene. render();
61- scene. closeContext();
6259 // uncomment to asynchronously update boid avatar. See mouseClicked()
6360 // updateAvatar(scene.node("mouseClicked"));
6461}
@@ -96,7 +93,7 @@ void updateAvatar(Node node) {
9693void thirdPerson () {
9794 scene. eye(). setReference(avatar);
9895 avatar. setWorldMagnitude(scene. eye());
99- scene. fit(avatar, 1 );
96+ scene. fit(avatar, 1000 );
10097}
10198
10299// Resets the eye
@@ -105,7 +102,7 @@ void resetEye() {
105102 scene. lookAt(scene. center());
106103 if (avatar != null )
107104 avatar. setMagnitude(1 );
108- scene. fit(1 );
105+ scene. fit(1000 );
109106}
110107
111108// picks up a boid avatar, may be null
@@ -174,7 +171,7 @@ void keyPressed() {
174171 break ;
175172 case ' s' :
176173 if (scene. eye(). reference() == null )
177- scene. fit(1 );
174+ scene. fit(1000 );
178175 break ;
179176 case ' p' :
180177 println (" Frame rate: " + frameRate );
0 commit comments