Hi
I'm working my way through the BoxWrap2D tutorial at:
http://processing.org/discourse/yabb2/Y ... 1247034244
see code below.
I've got to the 2nd section of code and added 2 rects and 1 circle.
I see the green rectangles but do not see a circle?
Has anyone else encountered this problem?
I'm using JBox2D-2.0.1-b250-Full.
Thanks
Graham
=====================
import org.jbox2d.collision.*;
import org.jbox2d.dynamics.contacts.*;
import org.jbox2d.collision.shapes.*;
import org.jbox2d.dynamics.*;
import org.jbox2d.util.nonconvex.*;
import org.jbox2d.dynamics.joints.*;
import org.jbox2d.util.blob.*;
import org.jbox2d.testbed.tests.character.*;
import org.jbox2d.p5.*;
import processing.xml.*;
import processing.core.*;
import org.jbox2d.common.*;
import org.jbox2d.util.sph.*;
import org.jbox2d.pooling.arrays.*;
import org.jbox2d.dynamics.controllers.*;
import org.jbox2d.testbed.mathtests.*;
import org.jbox2d.pooling.*;
import org.jbox2d.testbed.timingTests.*;
import org.jbox2d.testbed.tests.*;
import org.jbox2d.pooling.stacks.*;
import org.jbox2d.testbed.*;
// Tutorial //
// http://processing.org/discourse/yabb2/Y ... 1247034244 //
// //
// A reference to the physics engine
Physics physics;
void setup()
{
// Medium sized scene
size(640, 480);
// Physics is computed 60 times per second, so let's draw at same rate
frameRate(60);
// Nicer graphisc
smooth();
// Set up everything physics
InitScene();
CreateObjects();
}
void draw()
{
// Not much to do here, most drawing is handled by BoxWrap2D
background(255);
}
void mousePressed()
{
// Do something interactive, like creating new objects
}
void keyPressed()
{
// Can be used to reset the sketch, for example
physics.destroy();
physics = null;
InitScene();
}
void InitScene()
{
// Set up the engine with the sketch's dimensions
physics = new Physics(this, width, height);
physics.setDensity(1.0);
}
void CreateObjects()
{
// A round object in the middle of the scene (center coordinates, radius)
physics.createCircle(width / 2.0, height / 2.0, 50.0);
// And two rectangles not far (coordinates of top-left, and bottom-right corners)
physics.createRect(
width / 2.0 - 150, height / 2.0 - 50,
width / 2.0 - 75, height / 2.0 + 50
);
physics.createRect(
width / 2.0 + 75, height / 2.0 - 40,
width / 2.0 + 175, height / 2.0 + 40
);
}
I'm working my way through the BoxWrap2D tutorial at:
http://processing.org/discourse/yabb2/Y ... 1247034244
see code below.
I've got to the 2nd section of code and added 2 rects and 1 circle.
I see the green rectangles but do not see a circle?
Has anyone else encountered this problem?
I'm using JBox2D-2.0.1-b250-Full.
Thanks
Graham
=====================
import org.jbox2d.collision.*;
import org.jbox2d.dynamics.contacts.*;
import org.jbox2d.collision.shapes.*;
import org.jbox2d.dynamics.*;
import org.jbox2d.util.nonconvex.*;
import org.jbox2d.dynamics.joints.*;
import org.jbox2d.util.blob.*;
import org.jbox2d.testbed.tests.character.*;
import org.jbox2d.p5.*;
import processing.xml.*;
import processing.core.*;
import org.jbox2d.common.*;
import org.jbox2d.util.sph.*;
import org.jbox2d.pooling.arrays.*;
import org.jbox2d.dynamics.controllers.*;
import org.jbox2d.testbed.mathtests.*;
import org.jbox2d.pooling.*;
import org.jbox2d.testbed.timingTests.*;
import org.jbox2d.testbed.tests.*;
import org.jbox2d.pooling.stacks.*;
import org.jbox2d.testbed.*;
// Tutorial //
// http://processing.org/discourse/yabb2/Y ... 1247034244 //
// //
// A reference to the physics engine
Physics physics;
void setup()
{
// Medium sized scene
size(640, 480);
// Physics is computed 60 times per second, so let's draw at same rate
frameRate(60);
// Nicer graphisc
smooth();
// Set up everything physics
InitScene();
CreateObjects();
}
void draw()
{
// Not much to do here, most drawing is handled by BoxWrap2D
background(255);
}
void mousePressed()
{
// Do something interactive, like creating new objects
}
void keyPressed()
{
// Can be used to reset the sketch, for example
physics.destroy();
physics = null;
InitScene();
}
void InitScene()
{
// Set up the engine with the sketch's dimensions
physics = new Physics(this, width, height);
physics.setDensity(1.0);
}
void CreateObjects()
{
// A round object in the middle of the scene (center coordinates, radius)
physics.createCircle(width / 2.0, height / 2.0, 50.0);
// And two rectangles not far (coordinates of top-left, and bottom-right corners)
physics.createRect(
width / 2.0 - 150, height / 2.0 - 50,
width / 2.0 - 75, height / 2.0 + 50
);
physics.createRect(
width / 2.0 + 75, height / 2.0 - 40,
width / 2.0 + 175, height / 2.0 + 40
);
}