@@ -36,7 +36,7 @@ function setup() {
36
36
cameraControls = QuickSettings . create ( 5 , 5 , "Camera Controls" ) ;
37
37
cameraControls . addRange ( "camera x rotation" , - TWO_PI , TWO_PI , 0 , 0.1 , camXChange ) ;
38
38
cameraControls . addRange ( "camera y rotation" , - PI , PI , - PI / 2 , 0.1 , camYChange ) ;
39
- cameraControls . addRange ( "camera z position" , - 1500 , 1500 , - 500 , 1 , camZChange ) ;
39
+ cameraControls . addRange ( "camera z position" , - 15000 , 1500 , - 500 , 1 , camZChange ) ;
40
40
cameraControls . addButton ( "camera reset" , resetCam ) ;
41
41
42
42
simulationParameters = QuickSettings . create ( 255 , 5 , "Simulation Parameters" ) ;
@@ -52,12 +52,13 @@ function setup() {
52
52
//disconnect sound file and send it to output via Panner3D
53
53
soundFile . disconnect ( ) ;
54
54
panner3d = new p5 . Panner3D ( ) ;
55
+ listener3d = new p5 . Listener3D ( ) ;
56
+ //listener3d.connect(panner3d);
55
57
soundFile . connect ( panner3d ) ;
56
58
soundFile . loop ( ) ;
57
59
58
60
59
- listener3d = new p5 . Listener3D ( ) ;
60
-
61
+
61
62
62
63
}
63
64
@@ -86,6 +87,11 @@ function draw() {
86
87
panner3d . position ( flock . boids [ 0 ] . position . x ,
87
88
flock . boids [ 0 ] . position . y ,
88
89
flock . boids [ 0 ] . position . z ) ;
90
+
91
+ listener3d . spatializer . setPosition ( 0 , 0 , cam_z_pos )
92
+ //listener3d.orientX(cam_y_rot)
93
+ //listener3d.spatializer.orientY(cam_x_rot)
94
+ // listener3d.spatializer.setOrientation(cam_x_rot,cam_y_rot,0)
89
95
90
96
}
91
97
@@ -104,6 +110,7 @@ function resetFlock(){
104
110
flock = new Flock ( ) ;
105
111
for ( var i = 0 ; i < nb ; i ++ ) {
106
112
var b = new Boid ( 1 , 1 , - 400 ) ;
113
+ b . acceleration = createVector ( random ( 1 , 10 ) * cos ( random ( TWO_PI ) ) , random ( 1 , 10 ) * sin ( random ( TWO_PI ) ) , 0 )
107
114
flock . addBoid ( b ) ;
108
115
}
109
116
}
0 commit comments