/** * Call this after you are done with time steps to clear the forces. You normally call this after * each call to Step, unless you are performing sub-steps. By default, forces will be * automatically cleared, so you don't need to call this function. * * @see setAutoClearForces */ public void clearForces() { for (Body body = m_bodyList; body != null; body = body.getNext()) { body.m_force.setZero(); body.m_torque = 0.0f; } }
for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); for (Fixture f = b.getFixtureList(); f != null; f = f.getNext()) { color.set(0.9f, 0.3f, 0.9f); for (Body b = m_bodyList; b != null; b = b.getNext()) { if (b.isActive() == false) { continue; for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); xf.p.set(b.getWorldCenter());
/** * Call this after you are done with time steps to clear the forces. You normally call this after * each call to Step, unless you are performing sub-steps. By default, forces will be * automatically cleared, so you don't need to call this function. * * @see setAutoClearForces */ public void clearForces() { for (Body body = m_bodyList; body != null; body = body.getNext()) { body.m_force.setZero(); body.m_torque = 0.0f; } }
for (Body b = m_bodyList; b != null; b = b.getNext()) {
context.scale(100, 100); context.setLineWidth(0.01); for (Body body = scene.getWorld().getBodyList(); body != null; body = body.getNext()) { Vec2 center = body.getPosition(); context.save();
@Override public void step(TestbedSettings settings) { super.step(settings); for (Body b = getWorld().getBodyList(); b != null; b = b.getNext()) { if (b.getType() != BodyType.DYNAMIC) { continue; } Vec2 p = b.getPosition(); if (p.x <= -10.0f || 10.0f <= p.x || p.y <= 0.0f || 20.0f <= p.y) { p.x += 0.0; } } addTextLine("Press 'c' to create a circle"); }
for ( Body b = world.getBodyList(); b!=null; b = b.getNext() ) { // do something }
/** * Call this after you are done with time steps to clear the forces. You normally call this after * each call to Step, unless you are performing sub-steps. By default, forces will be * automatically cleared, so you don't need to call this function. * * @see setAutoClearForces */ public void clearForces() { for (Body body = m_bodyList; body != null; body = body.getNext()) { body.m_force.setZero(); body.m_torque = 0.0f; } }
/** * Call this after you are done with time steps to clear the forces. You normally call this after * each call to Step, unless you are performing sub-steps. By default, forces will be * automatically cleared, so you don't need to call this function. * * @see #setAutoClearForces(boolean) */ public void clearForces() { for (Body body = m_bodyList; body != null; body = body.getNext()) { body.m_force.setZero(); body.m_torque = 0.0f; } }
/** * Call this after you are done with time steps to clear the forces. You normally call this after * each call to Step, unless you are performing sub-steps. By default, forces will be * automatically cleared, so you don't need to call this function. * * @see setAutoClearForces */ public void clearForces() { for (Body body = m_bodyList; body != null; body = body.getNext()) { body.m_force.setZero(); body.m_torque = 0.0f; } }
for ( Body b = world.getBodyList(); b!=null; b = b.getNext() ) { Log.e("xy", String.valueOf(b.getPosition().x)+ " " + String.valueOf(b.getPosition().y)); }
for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); for (Fixture f = b.getFixtureList(); f != null; f = f.getNext()) { color.set(0.9f, 0.3f, 0.9f); for (Body b = m_bodyList; b != null; b = b.getNext()) { if (b.isActive() == false) { continue; for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); xf.p.set(b.getWorldCenter());
for (Body b = world.getBodyList(); b != null; b = b.getNext()) { CCSprite sprite = (CCSprite)b.getUserData(); if(sprite != null) { sprite.setPosition(worldToScreen(b.getPosition()))); sprite.setRotation(-1.0f * (float)Math.toDegrees((b.getAngle()))); } }
for (Body b = m_bodyList; b != null; b = b.getNext()) {
public void draw(Canvas canvas){ Body body = world.getBodyList(); while(body != null){ Fixture fixture = body.getFixtureList(); while(fixture != null){ ShapeType type = fixture.getType(); if(type == ShapeType.POLYGON){ PolygonShape shape = (PolygonShape)fixture.getShape(); // draw shape }else if(type == ShapeType.CIRCLE){ CircleShape shape = (CircleShape)fixture.getShape(); // draw shape } fixture = fixture.getNext(); } body = body.getNext(); } }
@Override public void step(TestbedSettings settings) { super.step(settings); for (Body b = getWorld().getBodyList(); b != null; b = b.getNext()) { if (b.getType() != BodyType.DYNAMIC) { continue; } Vec2 p = b.getPosition(); if (p.x <= -10.0f || 10.0f <= p.x || p.y <= 0.0f || 20.0f <= p.y) { p.x += 0.0; } } addTextLine("Press 'c' to create a circle"); }
for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); for (Fixture f = b.getFixtureList(); f != null; f = f.getNext()) { color.set(0.9f, 0.3f, 0.9f); for (Body b = m_bodyList; b != null; b = b.getNext()) { if (b.isActive() == false) { continue; for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); xf.p.set(b.getWorldCenter());
for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); for (Fixture f = b.getFixtureList(); f != null; f = f.getNext()) { color.set(0.9f, 0.3f, 0.9f); for (Body b = m_bodyList; b != null; b = b.getNext()) { if (b.isActive() == false) { continue; for (Body b = m_bodyList; b != null; b = b.getNext()) { xf.set(b.getTransform()); xf.p.set(b.getWorldCenter());
theBody = theBody.getNext();
for (Body b = world.getBodyList(); b != null; b = b.getNext()) { xf.set(b.getTransform()); for (Fixture f : b.getFixtures()) { color = Color.color(0.9f, 0.3f, 0.9f); for (Body b = world.getBodyList(); b != null; b = b.getNext()) { if (!b.isActive()) { continue; for (Body b = world.getBodyList(); b != null; b = b.getNext()) { xf.set(b.getTransform()); xf.p.set(b.getWorldCenter());