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


Java ContactImpulse类代码示例

本文整理汇总了Java中org.jbox2d.callbacks.ContactImpulse的典型用法代码示例。如果您正苦于以下问题:Java ContactImpulse类的具体用法?Java ContactImpulse怎么用?Java ContactImpulse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的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.callbacks.ContactImpulse; //导入依赖的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: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的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

示例4: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse impulse)
{
    Object userdataA = contact.m_fixtureA.m_body.m_userData;
    Object userdataB = contact.m_fixtureB.m_body.m_userData;
    if ((userdataA instanceof PhysicsParticle) && (userdataB instanceof PhysicsParticle));
        // particle - particle collision, do nothing
    else if ((userdataA instanceof PhysicsParticle) && (userdataB instanceof PhysicsComponent))
    {
        if (((PhysicsParticle) userdataA).destroyOnCollision)
            ((PhysicsParticle) userdataA).destroy();
    }
    else if ((userdataA instanceof PhysicsComponent) && (userdataB instanceof PhysicsParticle))
    {
        if (((PhysicsParticle) userdataB).destroyOnCollision)
            ((PhysicsParticle) userdataB).destroy();
    }
    else if ((userdataA instanceof PhysicsComponent) && (userdataB instanceof PhysicsComponent))
    {
        contactListeners.foreach((PhysicsContactListener listener) -> listener.tryPostSolve(contact));
    }
}
 
开发者ID:LoDoMa,项目名称:Lime,代码行数:23,代码来源:PhysicsContactManager.java

示例5: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse arg1) {
       Box2dPhysicsBody bodyA = (Box2dPhysicsBody) contact.m_fixtureA.getBody().getUserData();
       Box2dPhysicsBody bodyB = (Box2dPhysicsBody) contact.m_fixtureB.getBody().getUserData();
       
	if( arg1.normalImpulses[0]>=1.0 )
		bodyA.onPressed(arg1.normalImpulses[0]);

	if( arg1.normalImpulses.length>1 && arg1.normalImpulses[1]>=1.0 )
		bodyB.onPressed(arg1.normalImpulses[1]);
}
 
开发者ID:lowkey42,项目名称:java-jumpandrun-dev,代码行数:12,代码来源:Box2dContactListener.java

示例6: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
}
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:4,代码来源:box2d_Collisions_SensorTestCallback.java

示例7: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse impulse) 
{}
 
开发者ID:Joshuagollaher,项目名称:HawkEngine,代码行数:4,代码来源:WorldContactListener.java

示例8: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
/**
 * Internal use only
 */
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
	
}
 
开发者ID:pianoman373,项目名称:Point-Engine,代码行数:8,代码来源:Scene.java

示例9: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact arg0, ContactImpulse arg1) {}
 
开发者ID:Kairus101,项目名称:soccerRobots,代码行数:3,代码来源:Game.java

示例10: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact arg0, ContactImpulse arg1) {
	// TODO Auto-generated method stub
	
}
 
开发者ID:davidholiday,项目名称:ALTk,代码行数:6,代码来源:AdSplodeContactListener.java

示例11: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact arg0, ContactImpulse arg1) {
    // TODO Auto-generated method stub
    
}
 
开发者ID:davidholiday,项目名称:ALTk,代码行数:6,代码来源:AsteroidsContactListener.java

示例12: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
public void postSolve(Contact contact, ContactImpulse impulse) {
}
 
开发者ID:col726,项目名称:game-engine-CMZ,代码行数:3,代码来源:TestbedTest.java

示例13: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
	// TODO Auto-generated method stub

}
 
开发者ID:Mathgoat,项目名称:square-loot,代码行数:6,代码来源:PhysicsContactListener.java

示例14: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse arg1) {
	
}
 
开发者ID:tek256,项目名称:LD38,代码行数:5,代码来源:Physics.java

示例15: postSolve

import org.jbox2d.callbacks.ContactImpulse; //导入依赖的package包/类
/**
 * @see org.jbox2d.callbacks.ContactListener#postSolve(org.jbox2d.dynamics.contacts.Contact, org.jbox2d.callbacks.ContactImpulse)
 */
public void postSolve(Contact contact, ContactImpulse impulse) { }
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:TestbedTest.java


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