Hi, I've just started using b2djson to load a world designed in RUBE and saved to json format.
Newbie question, how to display the world object?
Also, how to access objects in the world?
Thanks in advance!
Newbie question, how to display the world object?
Also, how to access objects in the world?
Thanks in advance!
Code: Select all
[code][/code]Code: Select all
import shiffman.box2d.*;
import org.jbox2d.common.*;
import org.jbox2d.dynamics.joints.*;
import org.jbox2d.collision.shapes.*;
import org.jbox2d.collision.shapes.Shape;
import org.jbox2d.common.*;
import org.jbox2d.dynamics.*;
import org.jbox2d.dynamics.contacts.*;
// import the iforce2d libraries
import org.iforce2d.*;
Box2DProcessing box2d;
void setup() {
size(640, 360);
smooth();
box2d = new Box2DProcessing(this);
box2d.createWorld();
org.iforce2d.Jb2dJson json = new org.iforce2d.Jb2dJson() ;
StringBuilder errorMsg = new StringBuilder();
World world = json.readFromFile("bike.json ", errorMsg);
println(world);
println(errorMsg);
}
void draw() {
background(255);
box2d.step();
}