[fluxus] howto call more objects into the scene

nik gaffney nik at fo.am
Fri Oct 21 00:47:37 PDT 2005


> hiall, im needing some help on understanding how can one create in the
> scene new objects..ive been looking to the grab ungrab functions but i
> will like to say have new cubes added via an OSC message that counts up
> randomly.
> 
> so if it changes from 1 to 2, there will be a second cube in the scene...

if you know if will will always incease, then you can just call a function
to make a new cube each time an osc mesage like /cube is received,.

(define (more-cubes n)
  (display "cubes: ")
  (display n)
  (newline)
  (build-cube))

(define (listener)
  (if (osc-msg "/cube")
      (begin
        (more-cubes (osc 0))
        (newline))))

(every-frame "(listener)")

if you want to add more than one cube at a time, say '/cube 45'
look at setting a value with the current number of cubes ->

(define how-many-cubes 0)

then check & modify it in the more-cubes function. eg.

(define (more-cubes n)
  (display "more cubes: ")
  (display how-many-cubes)
  (newline)
  (if (<= n how-many-cubes)
      (display "this many cubes.") (newline)
      (begin
	(set! how-many-cubes (+ 1 how-many-cubes))
        (build-cube)
	(more-cubes n))))

btw,. this code isnt tested, so probably has a few bugs. should explain the
ideas enough hopefully,. .,.






More information about the Fluxus mailing list