本文整理汇总了Java中org.jbox2d.dynamics.contacts.Contact.getFixtureA方法的典型用法代码示例。如果您正苦于以下问题:Java Contact.getFixtureA方法的具体用法?Java Contact.getFixtureA怎么用?Java Contact.getFixtureA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jbox2d.dynamics.contacts.Contact
的用法示例。
在下文中一共展示了Contact.getFixtureA方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: preSolve
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的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);
}
}
示例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;
}
}
示例4: preSolve
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的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);
}
}
示例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;
}
}
示例6: 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);
}
}
示例7: pushContact
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
public void pushContact(Contact contact) {
Fixture fixtureA = contact.getFixtureA();
Fixture fixtureB = contact.getFixtureB();
if (contact.m_manifold.pointCount > 0 && !fixtureA.isSensor() && !fixtureB.isSensor()) {
fixtureA.getBody().setAwake(true);
fixtureB.getBody().setAwake(true);
}
ShapeType type1 = fixtureA.getType();
ShapeType type2 = fixtureB.getType();
IDynamicStack<Contact> creator = contactStacks[type1.ordinal()][type2.ordinal()].creator;
creator.push(contact);
}
示例8: beginContact
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
Fixture fixtureA = contact.getFixtureA();
Fixture fixtureB = contact.getFixtureB();
if (fixtureA == m_sensor) enableSensorAttraction(fixtureB, true);
if (fixtureB == m_sensor) enableSensorAttraction(fixtureA, true);
}
示例9: endContact
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
Fixture fixtureA = contact.getFixtureA();
Fixture fixtureB = contact.getFixtureB();
if (fixtureA == m_sensor) enableSensorAttraction(fixtureB, false);
if (fixtureB == m_sensor) enableSensorAttraction(fixtureA, false);
}
示例10: pushContact
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
public void pushContact(Contact contact) {
Fixture fixtureA = contact.getFixtureA();
Fixture fixtureB = contact.getFixtureB();
if (contact.m_manifold.pointCount > 0 && !fixtureA.isSensor() && !fixtureB.isSensor()) {
fixtureA.getBody().setAwake(true);
fixtureB.getBody().setAwake(true);
}
ShapeType type1 = fixtureA.getType();
ShapeType type2 = fixtureB.getType();
IDynamicStack<Contact> creator = contactStacks[type1.ordinal()][type2.ordinal()].creator;
creator.push(contact);
}
示例11: preSolve
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的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);
}
}
示例12: 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;
}
}
示例13: destroyFixture
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
/**
* Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts
* associated with this fixture. This will automatically adjust the mass of the body if the body
* is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly
* destroyed when the body is destroyed.
*
* @param fixture the fixture to be removed.
* @warning This function is locked during callbacks.
*/
public final void destroyFixture(Fixture fixture) {
assert (m_world.isLocked() == false);
if (m_world.isLocked() == true) {
return;
}
assert (fixture.m_body == this);
// Remove the fixture from this body's singly linked list.
assert (m_fixtureCount > 0);
Fixture node = m_fixtureList;
Fixture last = null; // java change
boolean found = false;
while (node != null) {
if (node == fixture) {
node = fixture.m_next;
found = true;
break;
}
last = node;
node = node.m_next;
}
// You tried to remove a shape that is not attached to this body.
assert (found);
// java change, remove it from the list
if (last == null) {
m_fixtureList = fixture.m_next;
} else {
last.m_next = fixture.m_next;
}
// Destroy any contacts associated with the fixture.
ContactEdge edge = m_contactList;
while (edge != null) {
Contact c = edge.contact;
edge = edge.next;
Fixture fixtureA = c.getFixtureA();
Fixture fixtureB = c.getFixtureB();
if (fixture == fixtureA || fixture == fixtureB) {
// This destroys the contact and removes it from
// this body's contact list.
m_world.m_contactManager.destroy(c);
}
}
if ((m_flags & e_activeFlag) == e_activeFlag) {
BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase;
fixture.destroyProxies(broadPhase);
}
fixture.destroy();
fixture.m_body = null;
fixture.m_next = null;
fixture = null;
--m_fixtureCount;
// Reset the mass data.
resetMassData();
}
示例14: destroy
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
public void destroy(Contact c) {
Fixture fixtureA = c.getFixtureA();
Fixture fixtureB = c.getFixtureB();
Body bodyA = fixtureA.getBody();
Body bodyB = fixtureB.getBody();
if (m_contactListener != null && c.isTouching()) {
m_contactListener.endContact(c);
}
// Remove from the world.
if (c.m_prev != null) {
c.m_prev.m_next = c.m_next;
}
if (c.m_next != null) {
c.m_next.m_prev = c.m_prev;
}
if (c == m_contactList) {
m_contactList = c.m_next;
}
// Remove from body 1
if (c.m_nodeA.prev != null) {
c.m_nodeA.prev.next = c.m_nodeA.next;
}
if (c.m_nodeA.next != null) {
c.m_nodeA.next.prev = c.m_nodeA.prev;
}
if (c.m_nodeA == bodyA.m_contactList) {
bodyA.m_contactList = c.m_nodeA.next;
}
// Remove from body 2
if (c.m_nodeB.prev != null) {
c.m_nodeB.prev.next = c.m_nodeB.next;
}
if (c.m_nodeB.next != null) {
c.m_nodeB.next.prev = c.m_nodeB.prev;
}
if (c.m_nodeB == bodyB.m_contactList) {
bodyB.m_contactList = c.m_nodeB.next;
}
// Call the factory.
pool.pushContact(c);
--m_contactCount;
}
示例15: destroyFixture
import org.jbox2d.dynamics.contacts.Contact; //导入方法依赖的package包/类
/**
* Destroy a fixture. This removes the fixture from the broad-phase and
* destroys all contacts associated with this fixture. This will
* automatically adjust the mass of the body if the body is dynamic and the
* fixture has positive density.
* All fixtures attached to a body are implicitly destroyed when the body is
* destroyed.
*
* @param fixture
* the fixture to be removed.
* @warning This function is locked during callbacks.
*/
public final void destroyFixture(Fixture fixture) {
assert (m_world.isLocked() == false);
if (m_world.isLocked() == true) {
return;
}
assert (fixture.m_body == this);
// Remove the fixture from this body's singly linked list.
assert (m_fixtureCount > 0);
Fixture node = m_fixtureList;
Fixture last = null; // java change
boolean found = false;
while (node != null) {
if (node == fixture) {
node = fixture.m_next;
found = true;
break;
}
last = node;
node = node.m_next;
}
// You tried to remove a shape that is not attached to this body.
assert (found);
// java change, remove it from the list
if (last == null) {
m_fixtureList = fixture.m_next;
}
else {
last.m_next = fixture.m_next;
}
// Destroy any contacts associated with the fixture.
ContactEdge edge = m_contactList;
while (edge != null) {
Contact c = edge.contact;
edge = edge.next;
Fixture fixtureA = c.getFixtureA();
Fixture fixtureB = c.getFixtureB();
if (fixture == fixtureA || fixture == fixtureB) {
// This destroys the contact and removes it from
// this body's contact list.
m_world.m_contactManager.destroy(c);
}
}
if ((m_flags & e_activeFlag) == e_activeFlag) {
assert (fixture.m_proxy != null);
BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase;
fixture.destroyProxy(broadPhase);
}
else {
assert (fixture.m_proxy == null);
}
fixture.destroy();
fixture.m_body = null;
fixture.m_next = null;
fixture = null;
--m_fixtureCount;
// Reset the mass data.
resetMassData();
}