org.jbox2d.dynamics.Body.setAwake()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中org.jbox2d.dynamics.Body.setAwake()方法的一些代码示例,展示了Body.setAwake()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.setAwake()方法的具体详情如下:
包路径:org.jbox2d.dynamics.Body
类名称:Body
方法名:setAwake

Body.setAwake介绍

[英]Set the sleep state of the body. A sleeping body has very low CPU cost.
[中]设置身体的睡眠状态。睡眠体的CPU成本非常低。

代码示例

代码示例来源:origin: libgdx/libgdx

public void enableMotor(boolean flag) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_enableMotor = flag;
}

代码示例来源:origin: libgdx/libgdx

public void setMaxMotorTorque(float torque) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_maxMotorTorque = torque;
}

代码示例来源:origin: libgdx/libgdx

/**
 * Enable/disable the joint motor.
 * 
 * @param flag
 */
public void enableMotor(boolean flag) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_enableMotor = flag;
}

代码示例来源:origin: libgdx/libgdx

/**
 * Set the motor speed, usually in meters per second.
 * 
 * @param speed
 */
public void setMotorSpeed(float speed) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_motorSpeed = speed;
}

代码示例来源:origin: libgdx/libgdx

public void enableLimit(final boolean flag) {
 if (flag != m_enableLimit) {
  m_bodyA.setAwake(true);
  m_bodyB.setAwake(true);
  m_enableLimit = flag;
  m_impulse.z = 0.0f;
 }
}

代码示例来源:origin: libgdx/libgdx

public void setLimits(final float lower, final float upper) {
  assert (lower <= upper);
  if (lower != m_lowerAngle || upper != m_upperAngle) {
   m_bodyA.setAwake(true);
   m_bodyB.setAwake(true);
   m_impulse.z = 0.0f;
   m_lowerAngle = lower;
   m_upperAngle = upper;
  }
 }
}

代码示例来源:origin: libgdx/libgdx

public void enableMotor(boolean flag) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_enableMotor = flag;
}

代码示例来源:origin: libgdx/libgdx

public void setMotorSpeed(final float speed) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_motorSpeed = speed;
}

代码示例来源:origin: libgdx/libgdx

/**
 * Set if this fixture is a sensor.
 * 
 * @param sensor
 */
public void setSensor(boolean sensor) {
 if (sensor != m_isSensor) {
  m_body.setAwake(true);
  m_isSensor = sensor;
 }
}

代码示例来源:origin: libgdx/libgdx

public void setAllowSleep(boolean flag) {
 if (flag == m_allowSleep) {
  return;
 }
 m_allowSleep = flag;
 if (m_allowSleep == false) {
  for (Body b = m_bodyList; b != null; b = b.m_next) {
   b.setAwake(true);
  }
 }
}

代码示例来源:origin: libgdx/libgdx

/**
 * Set the maximum motor force, usually in N.
 * 
 * @param force
 */
public void setMaxMotorForce(float force) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_maxMotorForce = force;
}

代码示例来源:origin: libgdx/libgdx

/** Set the sleep state of the body. A sleeping body has very low CPU cost.
 * @param flag set to true to put body to sleep, false to wake it. */
public void setAwake (boolean flag) {
  body.setAwake(flag);
}

代码示例来源:origin: libgdx/libgdx

public void setMaxMotorTorque(final float torque) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_maxMotorTorque = torque;
}

代码示例来源:origin: libgdx/libgdx

public void setMotorSpeed(float speed) {
 m_bodyA.setAwake(true);
 m_bodyB.setAwake(true);
 m_motorSpeed = speed;
}

代码示例来源:origin: libgdx/libgdx

/**
 * Set the target angular offset, in radians.
 * 
 * @param angularOffset
 */
public void setAngularOffset(float angularOffset) {
 if (angularOffset != m_angularOffset) {
  m_bodyA.setAwake(true);
  m_bodyB.setAwake(true);
  m_angularOffset = angularOffset;
 }
}

代码示例来源:origin: libgdx/libgdx

/**
 * You can disable sleeping on this body. If you disable sleeping, the body will be woken.
 * 
 * @param flag
 */
public void setSleepingAllowed(boolean flag) {
 if (flag) {
  m_flags |= e_autoSleepFlag;
 } else {
  m_flags &= ~e_autoSleepFlag;
  setAwake(true);
 }
}

代码示例来源:origin: libgdx/libgdx

/**
 * Enable/disable the joint limit.
 * 
 * @param flag
 */
public void enableLimit(boolean flag) {
 if (flag != m_enableLimit) {
  m_bodyA.setAwake(true);
  m_bodyB.setAwake(true);
  m_enableLimit = flag;
  m_impulse.z = 0.0f;
 }
}

代码示例来源:origin: libgdx/libgdx

/**
 * Set the target linear offset, in frame A, in meters.
 */
public void setLinearOffset(Vec2 linearOffset) {
 if (linearOffset.x != m_linearOffset.x || linearOffset.y != m_linearOffset.y) {
  m_bodyA.setAwake(true);
  m_bodyB.setAwake(true);
  m_linearOffset.set(linearOffset);
 }
}

代码示例来源:origin: libgdx/libgdx

public void setTarget(Vec2 target) {
 if (m_bodyB.isAwake() == false) {
  m_bodyB.setAwake(true);
 }
 m_targetA.set(target);
}

代码示例来源:origin: libgdx/libgdx

public void pushContact(Contact contact) {
 Fixture fixtureA = contact.getFixtureA();
 Fixture fixtureB = contact.getFixtureB();
 if (contact.m_manifold.pointCount > 0 && !fixtureA.isSensor() && !fixtureB.isSensor()) {
  fixtureA.getBody().setAwake(true);
  fixtureB.getBody().setAwake(true);
 }
 ShapeType type1 = fixtureA.getType();
 ShapeType type2 = fixtureB.getType();
 IDynamicStack<Contact> creator = contactStacks[type1.ordinal()][type2.ordinal()].creator;
 creator.push(contact);
}

相关文章