本文整理汇总了Java中org.jbox2d.dynamics.contacts.Contact.flagForFiltering方法的典型用法代码示例。如果您正苦于以下问题:Java Contact.flagForFiltering方法的具体用法?Java Contact.flagForFiltering怎么用?Java Contact.flagForFiltering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jbox2d.dynamics.contacts.Contact
的用法示例。
在下文中一共展示了Contact.flagForFiltering方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFilterData
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
/**
* Set the contact filtering data. This is an expensive operation and should
* not be called frequently. This will not update contacts until the next time
* step when either parent body is awake.
* @param filter
*/
public void setFilterData(final Filter filter){
m_filter.set(filter);
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;
}
}
示例2: refilter
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的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);
}
}