/** Set the angular velocity. */ public void setAngularVelocity (float omega) { body.setAngularVelocity(omega); }
public void launch() { m_body.setTransform(new Vec2(0.0f, 20.0f), 0.0f); m_angularVelocity = (float) Math.random() * 100 - 50; m_body.setLinearVelocity(new Vec2(0.0f, -100.0f)); m_body.setAngularVelocity(m_angularVelocity); }
public void launch() { m_body.setTransform(new Vec2(0.0f, 4.0f), 0.0f); m_body.setLinearVelocity(new Vec2()); m_body.setAngularVelocity(0.0f); m_x = MathUtils.randomFloat(-1.0f, 1.0f); m_bullet.setTransform(new Vec2(m_x, 10.0f), 0.0f); m_bullet.setLinearVelocity(new Vec2(0.0f, -50.0f)); m_bullet.setAngularVelocity(0.0f); Distance.GJK_CALLS = 0; Distance.GJK_ITERS = 0; Distance.GJK_MAX_ITERS = 0; TimeOfImpact.toiCalls = 0; TimeOfImpact.toiIters = 0; TimeOfImpact.toiMaxIters = 0; TimeOfImpact.toiRootIters = 0; TimeOfImpact.toiMaxRootIters = 0; }
@Override public void keyPressed(char argKeyChar, int argKeyCode) { switch (argKeyChar) { case 'd': m_platform.setType(BodyType.DYNAMIC); break; case 's': m_platform.setType(BodyType.STATIC); break; case 'k': m_platform.setType(BodyType.KINEMATIC); m_platform.setLinearVelocity(new Vec2(-m_speed, 0.0f)); m_platform.setAngularVelocity(0.0f); break; } }
void Break() { // Create two bodies from one. Body body1 = m_piece1.getBody(); Vec2 center = body1.getWorldCenter(); body1.destroyFixture(m_piece2); m_piece2 = null; BodyDef bd = new BodyDef(); bd.type = BodyType.DYNAMIC; bd.position = body1.getPosition(); bd.angle = body1.getAngle(); Body body2 = getWorld().createBody(bd); m_piece2 = body2.createFixture(m_shape2, 1.0f); // Compute consistent velocities for new bodies based on // cached velocity. Vec2 center1 = body1.getWorldCenter(); Vec2 center2 = body2.getWorldCenter(); Vec2 velocity1 = m_velocity.add(Vec2.cross(m_angularVelocity, center1.sub(center))); Vec2 velocity2 = m_velocity.add(Vec2.cross(m_angularVelocity, center2.sub(center))); body1.setAngularVelocity(m_angularVelocity); body1.setLinearVelocity(velocity1); body2.setAngularVelocity(m_angularVelocity); body2.setLinearVelocity(velocity2); }
m_angularVelocity = 33.468121f; m_body.setLinearVelocity(new Vec2(0.0f, -100.0f)); m_body.setAngularVelocity(m_angularVelocity);
b.createFixture(fd); b.setLinearVelocity(new Vec2(-25f, -25f)); b.setAngularVelocity(6.7f); b.createFixture(fd); b.setLinearVelocity(new Vec2(35f, -10f)); b.setAngularVelocity(-8.3f);
public void launch() { m_body.setTransform(new Vec2(0.0f, 20.0f), 0.0f); m_angularVelocity = (float) Math.random() * 100 - 50; m_body.setLinearVelocity(new Vec2(0.0f, -100.0f)); m_body.setAngularVelocity(m_angularVelocity); }
void shake() { body.setLinearVelocity(new Vec2(random(-5, 5), random(2, 5))); body.setAngularVelocity(random(-5, 5)); }
@Override public void keyPressed(char argKeyChar, int argKeyCode) { switch (argKeyChar) { case 'd': m_platform.setType(BodyType.DYNAMIC); break; case 's': m_platform.setType(BodyType.STATIC); break; case 'k': m_platform.setType(BodyType.KINEMATIC); m_platform.setLinearVelocity(new Vec2(-m_speed, 0.0f)); m_platform.setAngularVelocity(0.0f); break; } }
body.setAngularVelocity(w); body.setLinearVelocity(new Vec2(-8.0f * w, 0.0f));
void Break() { // Create two bodies from one. Body body1 = m_piece1.getBody(); Vec2 center = body1.getWorldCenter(); body1.destroyFixture(m_piece2); m_piece2 = null; BodyDef bd = new BodyDef(); bd.type = BodyType.DYNAMIC; bd.position = body1.getPosition(); bd.angle = body1.getAngle(); Body body2 = getWorld().createBody(bd); m_piece2 = body2.createFixture(m_shape2, 1.0f); // Compute consistent velocities for new bodies based on // cached velocity. Vec2 center1 = body1.getWorldCenter(); Vec2 center2 = body2.getWorldCenter(); Vec2 velocity1 = m_velocity.add(Vec2.cross(m_angularVelocity, center1.sub(center))); Vec2 velocity2 = m_velocity.add(Vec2.cross(m_angularVelocity, center2.sub(center))); body1.setAngularVelocity(m_angularVelocity); body1.setLinearVelocity(velocity1); body2.setAngularVelocity(m_angularVelocity); body2.setLinearVelocity(velocity2); }
m_angularVelocity = 33.468121f; m_body.setLinearVelocity(new Vec2(0.0f, -100.0f)); m_body.setAngularVelocity(m_angularVelocity);
b.createFixture(fd); b.setLinearVelocity(new Vec2(-25f, -25f)); b.setAngularVelocity(6.7f); b.createFixture(fd); b.setLinearVelocity(new Vec2(35f, -10f)); b.setAngularVelocity(-8.3f);
body.setAngularVelocity(w); body.setLinearVelocity(new Vec2(-8.0f * w, 0.0f));