Package org.jbox2d.dynamics

Examples of org.jbox2d.dynamics.Body


    boolean sensorA = m_fixtureA.isSensor();
    boolean sensorB = m_fixtureB.isSensor();
    boolean sensor = sensorA || sensorB;

    Body bodyA = m_fixtureA.getBody();
    Body bodyB = m_fixtureB.getBody();
    Transform xfA = bodyA.getTransform();
    Transform xfB = bodyB.getTransform();
    // log.debug("TransformA: "+xfA);
    // log.debug("TransformB: "+xfB);

    if (sensor) {
      Shape shapeA = m_fixtureA.getShape();
      Shape shapeB = m_fixtureB.getShape();
      touching = pool.getCollision().testOverlap(shapeA, m_indexA, shapeB, m_indexB, xfA, xfB);

      // Sensors don't generate manifolds.
      m_manifold.pointCount = 0;
    } else {
      evaluate(m_manifold, xfA, xfB);
      touching = m_manifold.pointCount > 0;

      // Match old contact ids to new contact ids and copy the
      // stored impulses to warm start the solver.
      for (int i = 0; i < m_manifold.pointCount; ++i) {
        ManifoldPoint mp2 = m_manifold.points[i];
        mp2.normalImpulse = 0.0f;
        mp2.tangentImpulse = 0.0f;
        ContactID id2 = mp2.id;

        for (int j = 0; j < oldManifold.pointCount; ++j) {
          ManifoldPoint mp1 = oldManifold.points[j];

          if (mp1.id.isEqual(id2)) {
            mp2.normalImpulse = mp1.normalImpulse;
            mp2.tangentImpulse = mp1.tangentImpulse;
            break;
          }
        }
      }

      if (touching != wasTouching) {
        bodyA.setAwake(true);
        bodyB.setAwake(true);
      }
    }

    if (touching) {
      m_flags |= TOUCHING_FLAG;
View Full Code Here


      final Fixture fixtureB = contact.m_fixtureB;
      final Shape shapeA = fixtureA.getShape();
      final Shape shapeB = fixtureB.getShape();
      final float radiusA = shapeA.m_radius;
      final float radiusB = shapeB.m_radius;
      final Body bodyA = fixtureA.getBody();
      final Body bodyB = fixtureB.getBody();
      final Manifold manifold = contact.getManifold();

      int pointCount = manifold.pointCount;
      assert (pointCount > 0);
View Full Code Here

  public float getReactionTorque (float inv_dt) {
    return inv_dt * m_impulse.z;
  }

  public float getJointAngle () {
    final Body b1 = m_bodyA;
    final Body b2 = m_bodyB;
    return b2.m_sweep.a - b1.m_sweep.a - m_referenceAngle;
  }
View Full Code Here

    final Body b2 = m_bodyB;
    return b2.m_sweep.a - b1.m_sweep.a - m_referenceAngle;
  }

  public float getJointSpeed () {
    final Body b1 = m_bodyA;
    final Body b2 = m_bodyB;
    return b2.m_angularVelocity - b1.m_angularVelocity;
  }
View Full Code Here

    return m_manifold;
  }

  /** Get the world manifold. */
  public void getWorldManifold (WorldManifold worldManifold) {
    final Body bodyA = m_fixtureA.getBody();
    final Body bodyB = m_fixtureB.getBody();
    final Shape shapeA = m_fixtureA.getShape();
    final Shape shapeB = m_fixtureB.getShape();

    worldManifold.initialize(m_manifold, bodyA.getTransform(), shapeA.m_radius, bodyB.getTransform(), shapeB.m_radius);
  }
View Full Code Here

    boolean sensorA = m_fixtureA.isSensor();
    boolean sensorB = m_fixtureB.isSensor();
    boolean sensor = sensorA || sensorB;

    Body bodyA = m_fixtureA.getBody();
    Body bodyB = m_fixtureB.getBody();
    Transform xfA = bodyA.getTransform();
    Transform xfB = bodyB.getTransform();
    // log.debug("TransformA: "+xfA);
    // log.debug("TransformB: "+xfB);

    if (sensor) {
      Shape shapeA = m_fixtureA.getShape();
      Shape shapeB = m_fixtureB.getShape();
      touching = pool.getCollision().testOverlap(shapeA, m_indexA, shapeB, m_indexB, xfA, xfB);

      // Sensors don't generate manifolds.
      m_manifold.pointCount = 0;
    } else {
      evaluate(m_manifold, xfA, xfB);
      touching = m_manifold.pointCount > 0;

      // Match old contact ids to new contact ids and copy the
      // stored impulses to warm start the solver.
      for (int i = 0; i < m_manifold.pointCount; ++i) {
        ManifoldPoint mp2 = m_manifold.points[i];
        mp2.normalImpulse = 0.0f;
        mp2.tangentImpulse = 0.0f;
        ContactID id2 = mp2.id;

        for (int j = 0; j < oldManifold.pointCount; ++j) {
          ManifoldPoint mp1 = oldManifold.points[j];

          if (mp1.id.isEqual(id2)) {
            mp2.normalImpulse = mp1.normalImpulse;
            mp2.tangentImpulse = mp1.tangentImpulse;
            break;
          }
        }
      }

      if (touching != wasTouching) {
        bodyA.setAwake(true);
        bodyB.setAwake(true);
      }
    }

    if (touching) {
      m_flags |= TOUCHING_FLAG;
View Full Code Here

  public float getReactionTorque (float inv_dt) {
    return inv_dt * m_impulse.z;
  }

  public float getJointAngle () {
    final Body b1 = m_bodyA;
    final Body b2 = m_bodyB;
    return b2.m_sweep.a - b1.m_sweep.a - m_referenceAngle;
  }
View Full Code Here

    final Body b2 = m_bodyB;
    return b2.m_sweep.a - b1.m_sweep.a - m_referenceAngle;
  }

  public float getJointSpeed () {
    final Body b1 = m_bodyA;
    final Body b2 = m_bodyB;
    return b2.m_angularVelocity - b1.m_angularVelocity;
  }
View Full Code Here

  public float getReactionTorque (float inv_dt) {
    return inv_dt * m_motorImpulse;
  }

  public float getJointTranslation () {
    Body b1 = m_bodyA;
    Body b2 = m_bodyB;

    Vec2 p1 = pool.popVec2();
    Vec2 p2 = pool.popVec2();
    Vec2 axis = pool.popVec2();
    b1.getWorldPointToOut(m_localAnchorA, p1);
    b2.getWorldPointToOut(m_localAnchorA, p2);
    p2.subLocal(p1);
    b1.getWorldVectorToOut(m_localXAxisA, axis);

    float translation = Vec2.dot(p2, axis);
    pool.pushVec2(3);
View Full Code Here

   *
   * /** Get the current joint translation speed, usually in meters per second.
   *
   * @return */
  public float getJointSpeed () {
    Body bA = m_bodyA;
    Body bB = m_bodyB;

    Vec2[] pc = pool.popVec2(9);
    Vec2 temp = pc[0];
    Vec2 rA = pc[1];
    Vec2 rB = pc[2];
View Full Code Here

TOP

Related Classes of org.jbox2d.dynamics.Body

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.