Update controlP5 values

Hello everyone,

I'm working on a project where the user is first questioned about his relation to the city in which he or she lives, according to those answers a 3D model of a city is generated using AABB boxes from toxiclibs. The questions are answered by some controlP5 toggles and sliders, nothing too fancy.

The project is almost finished but I'm having a hard time connecting the value from the answers to the 3D model. The problem is that in order for the city to be generated only once, the instruction for it's creation are set in the setup() (it's just a couple of nested for's that create a simple matrix of buildings), but in order for the values to change in real time and to use map() to adjust the answers so the values are in scale for the 3D model these are updated in the draw(), so the variables are indeed changing (I'm watching them change in the console by printing their values) but the city is still generated with the default values from when the variables where declared.

I hope someone can point me in the right direction, maybe a different way of organizing the structure of my program I'm not aware of?

Tagged:

Answers

  • Answer ✓

    I just fixed it. If anyone arrives to the same problem:

    I moved it to the draw() and used a:

    boolean runone = true;
    void draw() {
       if (runone) {
         //City builds up
         runone = false;
       }
    }
    
Sign In or Register to comment.