本文整理了Java中org.jbox2d.dynamics.Body.setAngularVelocity()
方法的一些代码示例,展示了Body.setAngularVelocity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.setAngularVelocity()
方法的具体详情如下:
包路径:org.jbox2d.dynamics.Body
类名称:Body
方法名:setAngularVelocity
[英]Set the angular velocity.
[中]设置角速度。
代码示例来源:origin: libgdx/libgdx
/** Set the angular velocity. */
public void setAngularVelocity (float omega) {
body.setAngularVelocity(omega);
}
代码示例来源:origin: jbox2d/jbox2d
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);
}
代码示例来源:origin: jbox2d/jbox2d
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;
}
代码示例来源:origin: jbox2d/jbox2d
@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;
}
}
代码示例来源:origin: jbox2d/jbox2d
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);
}
代码示例来源:origin: jbox2d/jbox2d
m_angularVelocity = 33.468121f;
m_body.setLinearVelocity(new Vec2(0.0f, -100.0f));
m_body.setAngularVelocity(m_angularVelocity);
代码示例来源:origin: jbox2d/jbox2d
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);
代码示例来源:origin: org.jbox2d/jbox2d-testbed
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);
}
代码示例来源:origin: InnoFang/Android-Code-Demos
void shake() {
body.setLinearVelocity(new Vec2(random(-5, 5), random(2, 5)));
body.setAngularVelocity(random(-5, 5));
}
代码示例来源:origin: org.jbox2d/jbox2d-testbed
@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;
}
}
代码示例来源:origin: jbox2d/jbox2d
body.setAngularVelocity(w);
body.setLinearVelocity(new Vec2(-8.0f * w, 0.0f));
代码示例来源:origin: org.jbox2d/jbox2d-testbed
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);
}
代码示例来源:origin: org.jbox2d/jbox2d-testbed
m_angularVelocity = 33.468121f;
m_body.setLinearVelocity(new Vec2(0.0f, -100.0f));
m_body.setAngularVelocity(m_angularVelocity);
代码示例来源:origin: org.jbox2d/jbox2d-testbed
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);
代码示例来源:origin: org.jbox2d/jbox2d-testbed
body.setAngularVelocity(w);
body.setLinearVelocity(new Vec2(-8.0f * w, 0.0f));
内容来源于网络,如有侵权,请联系作者删除!