本文整理汇总了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);
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
示例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));
}
}
示例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;
}
}
示例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);
}
示例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;
}
}
}
示例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;
}
示例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);
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
}