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


Java Contact.getManifold方法代码示例

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


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

示例1: postSolve

import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
  if (m_broke) {
    // The body already broke.
    return;
  }

  // Should the body break?
  int count = contact.getManifold().pointCount;

  float maxImpulse = 0.0f;
  for (int i = 0; i < count; ++i) {
    maxImpulse = MathUtils.max(maxImpulse, impulse.normalImpulses[i]);
  }
  
  if (maxImpulse > 30.0f) {
    // Flag the body for breaking.
    m_break = true;
  }
}
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:21,代码来源:box2d_Breakable.java

示例2: postSolve

import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
/**
 * @see org.jbox2d.testbed.framework.TestbedTest#postSolve(org.jbox2d.dynamics.contacts.Contact,
 *      org.jbox2d.callbacks.ContactImpulse)
 */
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
	if (m_broke) {
		// The body already broke.
		return;
	}
	
	// Should the body break?
	int count = contact.getManifold().pointCount;
	
	float maxImpulse = 0.0f;
	for (int i = 0; i < count; ++i) {
		maxImpulse = MathUtils.max(maxImpulse, impulse.normalImpulses[i]);
	}
	
	if (maxImpulse > 40.0f) {
		// Flag the body for breaking.
		m_break = true;
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:Breakable.java

示例3: preSolve

import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
/**
 * @see org.jbox2d.callbacks.ContactListener#preSolve(org.jbox2d.dynamics.contacts.Contact, org.jbox2d.collision.Manifold)
 */
public void preSolve(Contact contact, Manifold oldManifold) {
	Manifold manifold = contact.getManifold();
	
	if(manifold.pointCount == 0){
		return;
	}
	
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	Collision.getPointStates(state1, state2, oldManifold, manifold);
	
	contact.getWorldManifold(worldManifold);
	
	for(int i=0; i<manifold.pointCount && m_pointCount < MAX_CONTACT_POINTS; i++){
		ContactPoint cp = points[m_pointCount];
		cp.fixtureA = fixtureA;
		cp.fixtureB = fixtureB;
		cp.position.set(worldManifold.points[i]);
		cp.normal.set(worldManifold.normal);
		cp.state = state2[i];
		++m_pointCount;
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:28,代码来源:TestbedTest.java

示例4: postSolve

import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
  if (m_broke) {
    // The body already broke.
    return;
  }

  // Should the body break?
  int count = contact.getManifold().pointCount;

  float maxImpulse = 0.0f;
  for (int i = 0; i < count; ++i) {
    maxImpulse = MathUtils.max(maxImpulse, impulse.normalImpulses[i]);
  }

  if (maxImpulse > 40.0f) {
    // Flag the body for breaking.
    m_break = true;
  }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:21,代码来源:Breakable.java

示例5: preSolve

import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
public void preSolve(Contact contact, Manifold oldManifold) {
  Manifold manifold = contact.getManifold();

  if (manifold.pointCount == 0) {
    return;
  }

  Fixture fixtureA = contact.getFixtureA();
  Fixture fixtureB = contact.getFixtureB();

  Collision.getPointStates(state1, state2, oldManifold, manifold);

  contact.getWorldManifold(worldManifold);

  for (int i = 0; i < manifold.pointCount && pointCount < MAX_CONTACT_POINTS; i++) {
    ContactPoint cp = points[pointCount];
    cp.fixtureA = fixtureA;
    cp.fixtureB = fixtureB;
    cp.position.set(worldManifold.points[i]);
    cp.normal.set(worldManifold.normal);
    cp.state = state2[i];
    cp.normalImpulse = manifold.points[i].normalImpulse;
    cp.tangentImpulse = manifold.points[i].tangentImpulse;
    ++pointCount;
  }
}
 
开发者ID:weimingtom,项目名称:jbox2d,代码行数:27,代码来源:TestbedTest.java

示例6: preSolve

import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
public void preSolve(Contact contact, Manifold oldManifold) {
  Manifold manifold = contact.getManifold();

  if (manifold.pointCount == 0) {
    return;
  }

  Fixture fixtureA = contact.getFixtureA();
  Fixture fixtureB = contact.getFixtureB();

  Collision.getPointStates(state1, state2, oldManifold, manifold);

  contact.getWorldManifold(worldManifold);

  for (int i = 0; i < manifold.pointCount && pointCount < MAX_CONTACT_POINTS; i++) {
    ContactPoint cp = points[pointCount];
    cp.fixtureA = fixtureA;
    cp.fixtureB = fixtureB;
    cp.position.set(worldManifold.points[i]);
    cp.normal.set(worldManifold.normal);
    cp.state = state2[i];
    cp.normalImpulse = manifold.points[i].normalImpulse;
    cp.tangentImpulse = manifold.points[i].tangentImpulse;
    cp.separation = worldManifold.separations[i];
    ++pointCount;
  }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:28,代码来源:TestbedTest.java


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