Training

edited November 2013 in How To...

Hello everybody! I am student in design in France. I joined a class of programming, knowing absolutely nothing about this domain. So I try a little to practice on my spare time. And I would like to know how to create a shape in 3D (a cube for example) and to be able to make it interact with the mouse when we cross it above. Thank you in advance! :)

Answers

  • Unless you have to create the cube from scratch you might try the Shapes3D library. Use Sketch | Import Library | Add Library menu option and install it. Then select Files | Examples and try the examples that come with it.

  • Another option may be to use P3D and Processing's built in transformation matrices:

    float theta = 0.0;
    
    void setup() {
      size(400, 400, P3D);
    }
    
    void draw() {
      background(128);
      translate(width/2, height/2);
      rotateY(theta);
      rotateZ(theta*0.5);
      box(100);
      theta += TWO_PI/1000.0;
    }
    
  • Thank you very much! I am going to manipulate a little bit then :)

Sign In or Register to comment.