本文整理了Java中org.jbox2d.dynamics.Body.applyLinearImpulse()
方法的一些代码示例,展示了Body.applyLinearImpulse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.applyLinearImpulse()
方法的具体详情如下:
包路径:org.jbox2d.dynamics.Body
类名称:Body
方法名:applyLinearImpulse
[英]Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body if 'wake' is set to true. If the body is sleeping and 'wake' is false, then there is no effect.
[中]在某一点上施加冲动。这会立即修改速度。如果应用点不在质心,它也会修改角速度。如果“唤醒”设置为true,则会唤醒身体。如果身体在睡觉,而“唤醒”是错误的,那么就没有效果。
代码示例来源:origin: libgdx/libgdx
/** Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of
* application is not at the center of mass. This wakes up the body.
* @param impulseX the world impulse vector on the x-axis, usually in N-seconds or kg-m/s.
* @param impulseY the world impulse vector on the y-axis, usually in N-seconds or kg-m/s.
* @param pointX the world position of the point of application on the x-axis.
* @param pointY the world position of the point of application on the y-axis. */
public void applyLinearImpulse (float impulseX, float impulseY, float pointX, float pointY, boolean wake) {
tmp.set(impulseX, impulseY);
tmp2.set(pointX, pointY);
body.applyLinearImpulse(tmp, tmp2, wake);
}
代码示例来源:origin: libgdx/libgdx
/** Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of
* application is not at the center of mass. This wakes up the body.
* @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
* @param point the world position of the point of application. */
public void applyLinearImpulse (Vector2 impulse, Vector2 point, boolean wake) {
tmp.set(impulse.x, impulse.y);
tmp2.set(point.x, point.y);
body.applyLinearImpulse(tmp, tmp2, wake);
}
代码示例来源:origin: libgdx/libgdx
f.x = -f.x;
f.y = -f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: libgdx/libgdx
f.x = -f.x;
f.y = -f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: libgdx/libgdx
va.x -= pInvMass * f.x;
va.y -= pInvMass * f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: libgdx/libgdx
velData.x -= particleInvMass * f.x;
velData.y -= particleInvMass * f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: libgdx/libgdx
f.x = fdn * b.x;
f.y = fdn * b.y;
body.applyLinearImpulse(f, p, true);
代码示例来源:origin: jbox2d/jbox2d
f.x = -f.x;
f.y = -f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: jbox2d/jbox2d
f.x = -f.x;
f.y = -f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: jbox2d/jbox2d
va.x -= pInvMass * f.x;
va.y -= pInvMass * f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: jbox2d/jbox2d
velData.x -= particleInvMass * f.x;
velData.y -= particleInvMass * f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: jbox2d/jbox2d
f.x = fdn * b.x;
f.y = fdn * b.y;
body.applyLinearImpulse(f, p, true);
代码示例来源:origin: andmizi/MobikeTags
public void random() {
int childCount = mViewgroup.getChildCount();
for (int i = 0; i < childCount; i++) {
Vec2 impulse = new Vec2(random.nextInt(1000) - 1000, random.nextInt(1000) - 1000);
View view = mViewgroup.getChildAt(i);
Body body = (Body) view.getTag(R.id.mobike_body_tag);
if(body != null){
body.applyLinearImpulse(impulse, body.getPosition(),true);
}
}
}
代码示例来源:origin: andmizi/MobikeTags
public void onSensorChanged(float x,float y) {
int childCount = mViewgroup.getChildCount();
for (int i = 0; i < childCount; i++) {
Vec2 impulse = new Vec2(x, y);
View view = mViewgroup.getChildAt(i);
Body body = (Body) view.getTag(R.id.mobike_body_tag);
if(body != null){
body.applyLinearImpulse(impulse, body.getPosition(),true);
}
}
}
代码示例来源:origin: stackoverflow.com
public void pushBall() {
if(stopWorld) {
return;
}
stopWorld = true;
Body ball = createBall(40*n, 40*n);
int velocity = ballParameters.getVelocity();
int angleDeg = ballParameters.getAngle();
int vx = (int) (velocity*Math.cos(Math.toRadians(angleDeg)));
int vy = (int) (velocity*Math.sin(Math.toRadians(angleDeg)));
ball.applyLinearImpulse(vx, vy, ball.getPosition().x, ball.getPosition().y, true);
stopWorld = false;
}
代码示例来源:origin: HpWens/MeiWidgetView
private void applyLinearImpulse(float x, float y, View view) {
Body body = (Body) view.getTag(R.id.wd_view_body_tag);
if (null != body) {
//N秒或kg-m / s为单位
Vec2 vec2 = new Vec2(x, y);
//对body施加一个冲量
/// 应用一个冲量到一个点上,这将立即改变速度。(这句话的意思是突然在一个点上作用一个力)
/// 如果这个点不再应用程序的质心上,它还会修改角速度. 唤醒 body.
/// @param impulse world 的矢量冲量, 通常 N-seconds or kg-m/s.
/// @param point 应用里面的某个点的 world 位置
body.applyLinearImpulse(vec2, body.getPosition(), true);
}
}
}
代码示例来源:origin: mirkosertic/GameComposer
void applyImpulse(GameObjectInstance aInstance, Force aForce) {
Body theBody = dynamicObjects.get(aInstance);
if (theBody != null) {
theBody.applyLinearImpulse(new Vec2(aForce.forceX, aForce.forceY), theBody.getWorldCenter());
}
}
代码示例来源:origin: stackoverflow.com
if (keycode == Input.Keys.UP)
{
Body body = player.getBody();
body.applyLinearImpulse(new Vector2(0, 30000), body.getWorldCenter(), true);
}
代码示例来源:origin: com.github.almasb/fxgl-physics
f.x = -f.x;
f.y = -f.y;
b.applyLinearImpulse(f, p, true);
代码示例来源:origin: stackoverflow.com
super(pX, pY, pTextureRegion, pVertexBufferObjectManager);
body = PhysicsFactory.createCircleBody(mPhysicsWorld, this, BodyType.DynamicBody, PhysicsFactory.createFixtureDef(0, 1, 0));
body.applyLinearImpulse(((float)5),(float) 5, body.getWorldCenter().x, body.getWorldCenter().y);
mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(this, body, true, true));
scene.attachChild(this);
内容来源于网络,如有侵权,请联系作者删除!