Librarian nightmare & dream

How to use JBullet

To use Jbullet easily in the new processing 1.0, you can just follow these steps:

  1. install Java3D to have access to some standard matrix operations in Processing & Java. What you really need is only the vecmath class. If Processing (depending on the version & settings) still does not see it, put the vecmath.jar inside processing’s libraries\vecmath\library.
  2. download Jbullet and be sure that you put jbullet.jar inside processing’s libraries\jbullet\library.
  3. restart Processing if it was running.

Download the Processing 1.0 pde file books.pde source code. And please, if you find this useful, post a link to your sketch or video that you did with this, I’m curious!

Addendum: if you want to use P5sunflow, then use processing v135: the version 1.0 seems not to be working with it. The code of the sketch is compatible, but you have to install the libraries in the processing folder itself.

Video

A video is on Vimeo.

Librarian’s nightmare & dream from Giulio on Vimeo.


3 Responses to “Librarian nightmare & dream”

  • david Says:

    Hey
    I was trying to adapt your example to use spheres but I cannot manage. Could you please show me how to do it?
    -david

  • Giulio Says:

    Answered by mail, but add this comment for completeness:

    Add a new function addSphere, similar to addBox, with this content:

    //ADD FALLING SPHERE
    CollisionShape fallShape = new SphereShape(30);
    myTransform = new Transform(); myTransform.origin.set(new Vector3f(pX,pY,pZ)); myTransform.setRotation(new Quat4f(0,0,quat3,1));
    DefaultMotionState fallMotionState = new DefaultMotionState(myTransform);
    float myFallMass = 1; Vector3f myFallInertia = new Vector3f(10,0,0);
    fallShape.calculateLocalInertia(myFallMass, myFallInertia);
    RigidBodyConstructionInfo fallRigidBodyCI = new RigidBodyConstructionInfo(myFallMass, fallMotionState, fallShape, myFallInertia);
    Book fallRigidBody = new Book(fallRigidBodyCI, c);
    myWorld.addRigidBody(fallRigidBody);
    fallRigidBodies.add(fallRigidBody);

    Then, in draw(), change box(..) with sphere(30);
    In setup(), add sphereDetail(8);

    That’s it! Have fun.

  • Matias Says:

    Hi!
    Your example is really usefull, thanks for that!
    I was trying to remove a book while the program is running but i couldnt, how can i do it?
    thanks for all!
    Matias.-

Leave a Reply