本文整理了Java中com.badlogic.gdx.physics.box2d.Body.getWorldPoint()
方法的一些代码示例,展示了Body.getWorldPoint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.getWorldPoint()
方法的具体详情如下:
包路径:com.badlogic.gdx.physics.box2d.Body
类名称:Body
方法名:getWorldPoint
[英]Get the world coordinates of a point given the local coordinates.
[中]获取给定局部坐标的点的世界坐标。
代码示例来源:origin: libgdx/libgdx
public boolean keyDown (int keyCode) {
if (keyCode == Keys.W) {
Vector2 f = m_body.getWorldVector(tmp.set(0, -200));
Vector2 p = m_body.getWorldPoint(tmp.set(0, 2));
m_body.applyForce(f, p, true);
}
if (keyCode == Keys.A) m_body.applyTorque(50, true);
if (keyCode == Keys.D) m_body.applyTorque(-50, true);
return false;
}
代码示例来源:origin: lycying/c2d-engine
static Vector2 worldPoint(b2BodyDefModel b2, Vector2 localVector) {
Vector2 tmp = new Vector2();
try {
tmp.set(b2.body.getWorldPoint(localVector.cpy().scl(1f / Box2dObject.RADIO))).scl(Box2dObject.RADIO);
} catch (Exception ex) {
//
}
return tmp;
}
}
代码示例来源:origin: lycying/c2d-engine
model.localAnchorB.set(0, 0);
final Vector2 worldA = model.bodyA.body.getWorldPoint(model.localAnchorA.cpy().scl(1f / Box2dObject.RADIO)).scl(Box2dObject.RADIO);
final Vector2 worldB = model.bodyB.body.getWorldPoint(model.localAnchorB.cpy().scl(1f / Box2dObject.RADIO)).scl(Box2dObject.RADIO);
if (model.groundAAlignAnchorA) {
model.groundAnchorA.x = worldA.x;
model.bodyA.body.getWorldPoint(model.localAnchorA.cpy().scl(1f / Box2dObject.RADIO)).sub(
model.bodyB.body.getWorldPoint(model.localAnchorB.cpy().scl(1f / Box2dObject.RADIO))
).scl(Box2dObject.RADIO).len();
model.bodyA.body.getWorldPoint(model.localAnchorA.cpy().scl(1f / Box2dObject.RADIO)).sub(
model.bodyB.body.getWorldPoint(model.localAnchorB.cpy().scl(1f / Box2dObject.RADIO))
).scl(Box2dObject.RADIO).len();
内容来源于网络,如有侵权,请联系作者删除!