/** Get the type of this body. */ public BodyType getType () { org.jbox2d.dynamics.BodyType type = body.getType(); if (type == org.jbox2d.dynamics.BodyType.DYNAMIC) return BodyType.DynamicBody; if (type == org.jbox2d.dynamics.BodyType.KINEMATIC) return BodyType.KinematicBody; if (type == org.jbox2d.dynamics.BodyType.STATIC) return BodyType.StaticBody; return BodyType.DynamicBody; }
public boolean reportFixture(Fixture argFixture) { Body body = argFixture.getBody(); if (body.getType() == BodyType.DYNAMIC) { boolean inside = argFixture.testPoint(point); if (inside) { fixture = argFixture; return false; } } return true; } }
if (b.getType() == BodyType.STATIC) { continue;
@Override public void step(TestbedSettings settings) { super.step(settings); addTextLine("Keys: (d) dynamic, (s) static, (k) kinematic"); // Drive the kinematic body. if (m_platform.getType() == BodyType.KINEMATIC) { Vec2 p = m_platform.getTransform().p; Vec2 v = m_platform.getLinearVelocity(); if ((p.x < -10.0f && v.x < 0.0f) || (p.x > 10.0f && v.x > 0.0f)) { v.x = -v.x; m_platform.setLinearVelocity(v); } } }
@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"); }
public boolean reportFixture(Fixture argFixture) { Body body = argFixture.getBody(); if (body.getType() == BodyType.DYNAMIC) { boolean inside = argFixture.testPoint(point); if (inside) { fixture = argFixture; return false; } } return true; } }
if (b.getType() == BodyType.STATIC) { continue;
@Override public void step(TestbedSettings settings) { super.step(settings); addTextLine("Keys: (d) dynamic, (s) static, (k) kinematic"); // Drive the kinematic body. if (m_platform.getType() == BodyType.KINEMATIC) { Vec2 p = m_platform.getTransform().p; Vec2 v = m_platform.getLinearVelocity(); if ((p.x < -10.0f && v.x < 0.0f) || (p.x > 10.0f && v.x > 0.0f)) { v.x = -v.x; m_platform.setLinearVelocity(v); } } }
@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"); }
color = Color.color(0.5f, 0.5f, 0.3f); drawShape(f, xf, color, wireframe); } else if (b.getType() == BodyType.STATIC) { color = Color.color(0.5f, 0.9f, 0.3f); drawShape(f, xf, color, wireframe); } else if (b.getType() == BodyType.KINEMATIC) { color = Color.color(0.5f, 0.5f, 0.9f); drawShape(f, xf, color, wireframe);