当前位置: 首页>>代码示例>>Java>>正文


Java BroadPhase.touchProxy方法代码示例

本文整理汇总了Java中org.jbox2d.collision.broadphase.BroadPhase.touchProxy方法的典型用法代码示例。如果您正苦于以下问题:Java BroadPhase.touchProxy方法的具体用法?Java BroadPhase.touchProxy怎么用?Java BroadPhase.touchProxy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jbox2d.collision.broadphase.BroadPhase的用法示例。


在下文中一共展示了BroadPhase.touchProxy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refilter

import org.jbox2d.collision.broadphase.BroadPhase; //导入方法依赖的package包/类
/**
 * Call this if you want to establish collision that was previously disabled by
 * ContactFilter::ShouldCollide.
 */
public void refilter() {
  if (m_body == null) {
    return;
  }

  // Flag associated contacts for filtering.
  ContactEdge edge = m_body.getContactList();
  while (edge != null) {
    Contact contact = edge.contact;
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();
    if (fixtureA == this || fixtureB == this) {
      contact.flagForFiltering();
    }
    edge = edge.next;
  }

  World world = m_body.getWorld();

  if (world == null) {
    return;
  }

  // Touch each proxy so that new pairs may be created
  BroadPhase broadPhase = world.m_contactManager.m_broadPhase;
  for (int i = 0; i < m_proxyCount; ++i) {
    broadPhase.touchProxy(m_proxies[i].proxyId);
  }
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:34,代码来源:Fixture.java

示例2: setType

import org.jbox2d.collision.broadphase.BroadPhase; //导入方法依赖的package包/类
/**
 * Set the type of this body. This may alter the mass and velocity.
 * 
 * @param type
 */
public void setType(BodyType type) {
  assert (m_world.isLocked() == false);
  if (m_world.isLocked() == true) {
    return;
  }

  if (m_type == type) {
    return;
  }

  m_type = type;

  resetMassData();

  if (m_type == BodyType.STATIC) {
    m_linearVelocity.setZero();
    m_angularVelocity = 0.0f;
    m_sweep.a0 = m_sweep.a;
    m_sweep.c0.set(m_sweep.c);
    synchronizeFixtures();
  }

  setAwake(true);

  m_force.setZero();
  m_torque = 0.0f;

  // Delete the attached contacts.
  ContactEdge ce = m_contactList;
  while (ce != null) {
    ContactEdge ce0 = ce;
    ce = ce.next;
    m_world.m_contactManager.destroy(ce0.contact);
  }
  m_contactList = null;

  // Touch the proxies so that new contacts will be created (when appropriate)
  BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase;
  for (Fixture f = m_fixtureList; f != null; f = f.m_next) {
    int proxyCount = f.m_proxyCount;
    for (int i = 0; i < proxyCount; ++i) {
      broadPhase.touchProxy(f.m_proxies[i].proxyId);
    }
  }
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:51,代码来源:Body.java


注:本文中的org.jbox2d.collision.broadphase.BroadPhase.touchProxy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。