We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Can anyone please show me the right way to draw textures in this lib? Like instead of a box, draw a PImage.
I made this through trial and error, which I use to draw an image that's close but not perfect to matching the box2d location. I'd rather not use magic numbers, there has to be a way to convert properly?
PVector getScreenLoc(Vec2 pos){
PVector pv = new PVector(pos.x,pos.y);
pv.x*=0.013;
pv.x += 450;
pv.y *= -9.8;
pv.y += height-236;
return pv;
}
Answers
is there a link for those of us who haven't heard of LiquidFun?
do you have any (runnable) example code so we don't have to start from the beginning?
LiquidFun can be found in the Add Library listing, it seems to be the best implementation of box2d for processing. Much higher and smoother framerates than the other two listed.
For a start I would point to the included example box2d_BrickWall and seeing if you can draw the bricks with a rect in place of the box2d rendering.
Here's my attempt. But this example doesn't move the box2d camera, the box2d_car example does and might be better, that's the part I was having problems with. Basically my scale settings are just tuned by hand to match, can't find a way to get it spot on. I've edited this to draw the bricks with rects instead of the box2d renderer
edit: I seem to have it kinda figured out enough