java - Libgdx Box2D Velocity is just not fast enough -
i have rectangle move fast ever reason faster velocity use still seems slow. doing wrong? have dropped circle above onto surface , tough play gravity comes down ballon...
some declarations
float velocity = 10000000f; static final float box_step=1/60f; static final int box_velocity_iterations=6; static final int box_position_iterations=2;
gravity, tried , seem suck
world = new world(new vector2(0, -50), true);
the ground object moving onto
//ground bodydef groundbodydef =new bodydef(); groundbodydef.position.set(new vector2(0, camera.viewportheight * .08f)); body groundbody = world.createbody(groundbodydef); polygonshape groundbox = new polygonshape(); groundbox.setasbox((camera.viewportwidth) * 2, camera.viewportheight * .08f); groundbody.createfixture(groundbox, 0.0f);
and here objects:
//ball bodydef = new bodydef(); bodydef.type = bodytype.dynamicbody; bodydef.position.set(new vector2(camera.viewportwidth * .2f, camera.viewportheight * .75f)); body = world.createbody(bodydef); circleshape dynamiccircle = new circleshape(); dynamiccircle.setradius(camera.viewportwidth * .035f); fixturedef fixturedef = new fixturedef(); fixturedef.shape = dynamiccircle; fixturedef.density = 0.5f; fixturedef.friction = 0.5f; fixturedef.restitution = 0.8f; body.createfixture(fixturedef); body.setlinearvelocity(0,-100); //slime boy bodydef bodyboxdef = new bodydef(); bodyboxdef.type = bodytype.dynamicbody; bodyboxdef.position.set(new vector2(camera.viewportwidth * .08f,camera.viewportheight * .191f)); bodybox = world.createbody(bodyboxdef); polygonshape slimebox = new polygonshape(); slimebox.setasbox(camera.viewportwidth * .04f, camera.viewportheight * .03f); fixturedef fixtureslimedef = new fixturedef(); fixtureslimedef.shape = slimebox; fixtureslimedef.density = 1.0f; fixtureslimedef.friction = 0.0f; fixtureslimedef.restitution = 0.0f; bodybox.createfixture(fixtureslimedef); debugrenderer = new box2ddebugrenderer(); body.applytorque(1000000000); bodybox.setfixedrotation(true); bodybox.setbullet(true);
any 1 have suggestions speed movement in this?
i have been using screen 1280 720 saw other sources smaller better scaled down 640 260 still not preformance want. how small should go?
from box2d manual (section 2.2):
box2d tuned meters, kilograms, , seconds. can consider extents in meters. box2d works best when objects size of typical real world objects. example, barrel 1 meter tall. due limitations of floating point arithmetic, using box2d model movement of glaciers or dust particles not idea.
Comments
Post a Comment