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


Java Manifold类代码示例

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


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

示例1: preSolve

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
	super.preSolve(contact, oldManifold);
	
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();

	if (fixtureA != m_platform && fixtureA != m_character){
		return;
	}

	if (fixtureB != m_character && fixtureB != m_character){
		return;
	}

	Vec2 position = m_character.getBody().getPosition();

	if (position.y < m_top + m_radius - 3.0f * Settings.linearSlop){
		contact.setEnabled(false);
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:OneSidedTest.java

示例2: preSolve

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

示例3: preSolve

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
  super.preSolve(contact, oldManifold);

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

  if (fixtureA != m_platform && fixtureA != m_character) {
    return;
  }

  if (fixtureB != m_character && fixtureB != m_character) {
    return;
  }

  Vec2 position = m_character.getBody().getPosition();

  if (position.y < m_top + m_radius - 3.0f * Settings.linearSlop) {
    contact.setEnabled(false);
  }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:22,代码来源:OneSidedTest.java

示例4: preSolve

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

示例5: preSolve

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
@Override
public void preSolve(Contact contact, Manifold oldManifold)
{
    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))
    {
        contact.setEnabled(false);
    }
    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.tryPreSolve(contact));
    }
}
 
开发者ID:LoDoMa,项目名称:Lime,代码行数:25,代码来源:PhysicsContactManager.java

示例6: preSolve

import org.jbox2d.collision.Manifold; //导入依赖的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];
		++pointCount;
	}
}
 
开发者ID:col726,项目名称:game-engine-CMZ,代码行数:26,代码来源:TestbedTest.java

示例7: evaluate

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
@Override
public void evaluate(Manifold manifold, Transform xfA, Transform xfB) {
  ChainShape chain = (ChainShape) m_fixtureA.getShape();
  chain.getChildEdge(edge, m_indexA);
  pool.getCollision().collideEdgeAndPolygon(manifold, edge, xfA,
      (PolygonShape) m_fixtureB.getShape(), xfB);
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:8,代码来源:ChainAndPolygonContact.java

示例8: storeImpulses

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
public void storeImpulses() {
  for (int i = 0; i < m_count; i++) {
    final ContactVelocityConstraint vc = m_velocityConstraints[i];
    final Manifold manifold = m_contacts[vc.contactIndex].getManifold();

    for (int j = 0; j < vc.pointCount; j++) {
      manifold.points[j].normalImpulse = vc.points[j].normalImpulse;
      manifold.points[j].tangentImpulse = vc.points[j].tangentImpulse;
    }
  }
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:12,代码来源:ContactSolver.java

示例9: Contact

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
protected Contact(IWorldPool argPool) {
  m_fixtureA = null;
  m_fixtureB = null;
  m_nodeA = new ContactEdge();
  m_nodeB = new ContactEdge();
  m_manifold = new Manifold();
  pool = argPool;
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:9,代码来源:Contact.java

示例10: evaluate

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
@Override
public void evaluate(Manifold manifold, Transform xfA, Transform xfB) {
  ChainShape chain = (ChainShape) m_fixtureA.getShape();
  chain.getChildEdge(edge, m_indexA);
  pool.getCollision().collideEdgeAndCircle(manifold, edge, xfA,
      (CircleShape) m_fixtureB.getShape(), xfB);
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:8,代码来源:ChainAndCircleContact.java

示例11: storeImpulses

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
public void storeImpulses(){
	for( int i=0; i<m_constraintCount; i++){
		final ContactConstraint c = m_constraints[i];
		final Manifold m = c.manifold;
		
		for(int j=0; j< c.pointCount; j++){
			m.points[j].normalImpulse = c.points[j].normalImpulse;
			m.points[j].tangentImpulse = c.points[j].tangentImpulse;
		}
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:ContactSolver.java

示例12: Contact

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
protected Contact(IWorldPool argPool) {
	m_fixtureA = null;
	m_fixtureB = null;
	m_nodeA = new ContactEdge();
	m_nodeB = new ContactEdge();
	m_manifold = new Manifold();
	pool = argPool;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:Contact.java

示例13: Contact

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
protected Contact(WorldPool argPool) {
	m_fixtureA = null;
	m_fixtureB = null;
	m_nodeA = new ContactEdge();
	m_nodeB = new ContactEdge();
	m_manifold = new Manifold();
	pool = argPool;
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:9,代码来源:Contact.java

示例14: preSolve

import org.jbox2d.collision.Manifold; //导入依赖的package包/类
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
  super.preSolve(contact, oldManifold);

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

  if (fixtureA == m_platform || fixtureB == m_platform) {
    contact.setTangentSpeed(5.0f);
  }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:12,代码来源:ConveyorBelt.java

示例15: preSolve

import org.jbox2d.collision.Manifold; //导入依赖的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.collision.Manifold类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。