本文整理了Java中org.jbox2d.dynamics.Body.isAwake()
方法的一些代码示例,展示了Body.isAwake()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.isAwake()
方法的具体详情如下:
包路径:org.jbox2d.dynamics.Body
类名称:Body
方法名:isAwake
[英]Get the sleeping state of this body.
[中]得到这个身体的睡眠状态。
代码示例来源:origin: libgdx/libgdx
/** Get the sleeping state of this body.
* @return true if the body is sleeping. */
public boolean isAwake () {
return body.isAwake();
}
代码示例来源:origin: libgdx/libgdx
/**
* Apply an angular impulse.
*
* @param impulse the angular impulse in units of kg*m*m/s
*/
public void applyAngularImpulse(float impulse) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (isAwake() == false) {
setAwake(true);
}
m_angularVelocity += m_invI * impulse;
}
代码示例来源:origin: libgdx/libgdx
/**
* Apply a torque. This affects the angular velocity without affecting the linear velocity of the
* center of mass. This wakes up the body.
*
* @param torque about the z-axis (out of the screen), usually in N-m.
*/
public final void applyTorque(float torque) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (isAwake() == false) {
setAwake(true);
}
m_torque += torque;
}
代码示例来源:origin: libgdx/libgdx
/**
* Apply a force to the center of mass. This wakes up the body.
*
* @param force the world force vector, usually in Newtons (N).
*/
public final void applyForceToCenter(Vec2 force) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (isAwake() == false) {
setAwake(true);
}
m_force.x += force.x;
m_force.y += force.y;
}
代码示例来源:origin: libgdx/libgdx
/**
* Apply a force at a world point. If the force is not applied at the center of mass, it will
* generate a torque and affect the angular velocity. This wakes up the body.
*
* @param force the world force vector, usually in Newtons (N).
* @param point the world position of the point of application.
*/
public final void applyForce(Vec2 force, Vec2 point) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (isAwake() == false) {
setAwake(true);
}
// m_force.addLocal(force);
// Vec2 temp = tltemp.get();
// temp.set(point).subLocal(m_sweep.c);
// m_torque += Vec2.cross(temp, force);
m_force.x += force.x;
m_force.y += force.y;
m_torque += (point.x - m_sweep.c.x) * force.y - (point.y - m_sweep.c.y) * force.x;
}
代码示例来源: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 if 'wake' is set to true. If the body is sleeping and 'wake' is false, then there is no
* effect.
*
* @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
* @param point the world position of the point of application.
* @param wake also wake up the body
*/
public final void applyLinearImpulse(Vec2 impulse, Vec2 point, boolean wake) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (!isAwake()) {
if (wake) {
setAwake(true);
} else {
return;
}
}
m_linearVelocity.x += impulse.x * m_invMass;
m_linearVelocity.y += impulse.y * m_invMass;
m_angularVelocity +=
m_invI * ((point.x - m_sweep.c.x) * impulse.y - (point.y - m_sweep.c.y) * impulse.x);
}
代码示例来源:origin: libgdx/libgdx
public void setTarget(Vec2 target) {
if (m_bodyB.isAwake() == false) {
m_bodyB.setAwake(true);
}
m_targetA.set(target);
}
代码示例来源:origin: libgdx/libgdx
boolean activeA = bodyA.isAwake() && bodyA.m_type != BodyType.STATIC;
boolean activeB = bodyB.isAwake() && bodyB.m_type != BodyType.STATIC;
代码示例来源:origin: jbox2d/jbox2d
/**
* Apply a force to the center of mass. This wakes up the body.
*
* @param force the world force vector, usually in Newtons (N).
*/
public final void applyForceToCenter(Vec2 force) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (isAwake() == false) {
setAwake(true);
}
m_force.x += force.x;
m_force.y += force.y;
}
代码示例来源:origin: jbox2d/jbox2d
/**
* Apply an angular impulse.
*
* @param impulse the angular impulse in units of kg*m*m/s
*/
public void applyAngularImpulse(float impulse) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (isAwake() == false) {
setAwake(true);
}
m_angularVelocity += m_invI * impulse;
}
代码示例来源:origin: jbox2d/jbox2d
/**
* Apply a torque. This affects the angular velocity without affecting the linear velocity of the
* center of mass. This wakes up the body.
*
* @param torque about the z-axis (out of the screen), usually in N-m.
*/
public final void applyTorque(float torque) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (isAwake() == false) {
setAwake(true);
}
m_torque += torque;
}
代码示例来源:origin: jbox2d/jbox2d
/**
* Apply a force at a world point. If the force is not applied at the center of mass, it will
* generate a torque and affect the angular velocity. This wakes up the body.
*
* @param force the world force vector, usually in Newtons (N).
* @param point the world position of the point of application.
*/
public final void applyForce(Vec2 force, Vec2 point) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (isAwake() == false) {
setAwake(true);
}
// m_force.addLocal(force);
// Vec2 temp = tltemp.get();
// temp.set(point).subLocal(m_sweep.c);
// m_torque += Vec2.cross(temp, force);
m_force.x += force.x;
m_force.y += force.y;
m_torque += (point.x - m_sweep.c.x) * force.y - (point.y - m_sweep.c.y) * force.x;
}
代码示例来源:origin: jbox2d/jbox2d
/**
* 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.
*
* @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
* @param point the world position of the point of application.
* @param wake also wake up the body
*/
public final void applyLinearImpulse(Vec2 impulse, Vec2 point, boolean wake) {
if (m_type != BodyType.DYNAMIC) {
return;
}
if (!isAwake()) {
if (wake) {
setAwake(true);
} else {
return;
}
}
m_linearVelocity.x += impulse.x * m_invMass;
m_linearVelocity.y += impulse.y * m_invMass;
m_angularVelocity +=
m_invI * ((point.x - m_sweep.c.x) * impulse.y - (point.y - m_sweep.c.y) * impulse.x);
}
代码示例来源:origin: jbox2d/jbox2d
public void setTarget(Vec2 target) {
if (m_bodyB.isAwake() == false) {
m_bodyB.setAwake(true);
}
m_targetA.set(target);
}
代码示例来源:origin: libgdx/libgdx
if (seed.isAwake() == false || seed.isActive() == false) {
continue;
代码示例来源:origin: libgdx/libgdx
assert (typeA == BodyType.DYNAMIC || typeB == BodyType.DYNAMIC);
boolean activeA = bA.isAwake() && typeA != BodyType.STATIC;
boolean activeB = bB.isAwake() && typeB != BodyType.STATIC;
代码示例来源:origin: libgdx/libgdx
color.set(0.5f, 0.5f, 0.9f);
drawShape(f, xf, color, wireframe);
} else if (b.isAwake() == false) {
color.set(0.5f, 0.5f, 0.5f);
drawShape(f, xf, color, wireframe);
代码示例来源:origin: jbox2d/jbox2d
boolean activeA = bodyA.isAwake() && bodyA.m_type != BodyType.STATIC;
boolean activeB = bodyB.isAwake() && bodyB.m_type != BodyType.STATIC;
代码示例来源:origin: jbox2d/jbox2d
builder.setAwake(argBody.isAwake());
builder.setActive(argBody.isActive());
builder.setFixedRotation(argBody.isFixedRotation());
代码示例来源:origin: jbox2d/jbox2d
color.set(0.5f, 0.5f, 0.9f);
drawShape(f, xf, color, wireframe);
} else if (b.isAwake() == false) {
color.set(0.5f, 0.5f, 0.5f);
drawShape(f, xf, color, wireframe);
内容来源于网络,如有侵权,请联系作者删除!