Package org.jbox2d.collision.shapes

Examples of org.jbox2d.collision.shapes.Shape


    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 {
View Full Code Here


      // System.out.println("contacts: " + m_count);
      final Contact contact = m_contacts[i];

      final Fixture fixtureA = contact.m_fixtureA;
      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();
View Full Code Here

  /** 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

    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 {
View Full Code Here

    if (m_count == e_maxCount) {
      return false;
    }

    Body body = fixture.getBody();
    Shape shape = fixture.getShape();

    boolean overlap = p.getCollision().testOverlap(shape, 0, m_circle, 0, body.getTransform(),
        m_transform);

    if (overlap) {
View Full Code Here

    Body ground;

    {
      CircleShape circleShape = new CircleShape();
      circleShape.m_radius = 1;
      Shape shape = circleShape;

      BodyDef bodyDef = new BodyDef();
      bodyDef.type = BodyType.DYNAMIC;
      bodyDef.position.set(-5, 0);
      bodyDef.allowSleep = false;
View Full Code Here

  }

  public Shape deserializeShape(PbShape argShape) {
    PbShape s = argShape;

    Shape shape = null;
    switch (s.getType()) {
      case CIRCLE:
        CircleShape c = new CircleShape();
        c.m_p.set(pbToVec(s.getCenter()));
        shape = c;
View Full Code Here

    Body ground;

    {
      CircleShape circleShape = new CircleShape();
      circleShape.m_radius = 1;
      Shape shape = circleShape;

      BodyDef bodyDef = new BodyDef();
      bodyDef.type = BodyType.DYNAMIC;
      bodyDef.position.set(-5, 0);
      bodyDef.allowSleep = false;
      pendulum = getWorld().createBody(bodyDef);
      pendulum.createFixture(shape, 1);
    }

    {
      PolygonShape shape = new PolygonShape();
      shape.setAsBox(1, 1);

      BodyDef bodyDef = new BodyDef();
      bodyDef.type = BodyType.DYNAMIC;
      bodyDef.position.set(0, 2);
      bodyDef.allowSleep = false;
      base = getWorld().createBody(bodyDef);
      base.createFixture(shape, 1);
    }

    {
      PolygonShape shape = new PolygonShape();
      shape.setAsBox(3, 1);

      BodyDef bodyDef = new BodyDef();
      bodyDef.type = BodyType.STATIC;
      ground = getWorld().createBody(bodyDef);
      ground.createFixture(shape, 0);
View Full Code Here

//        System.out.println("persist contact");
      }
      //@Override
      public void add(ContactPoint point) {
//        /*
        Shape shape1 = point.shape1;
        Shape shape2 = point.shape2;
        final Body body1 = shape1.getBody();
        final Body body2 = shape2.getBody();
        Object userData1 = body1.getUserData();
        Object userData2 = body2.getUserData();
       
        if (userData1 instanceof IPhysicsComponent  && userData2 instanceof IPhysicsComponent) { //Check for ball/star collision
          IPhysicsComponent physObj1 = (IPhysicsComponent) userData1;
View Full Code Here

    app.strokeWeight(1);
    app.pushMatrix();
//    this.getSceneCam().update();
    app.scale(scale, scale);
    for (Body body = world.getBodyList(); body != null; body = body.getNext()) {
      Shape shape;
      for (shape = body.getShapeList(); shape != null; shape = shape.getNext()) {
        switch (shape.getType()) {
        case POLYGON_SHAPE:
          app.beginShape();
          PolygonShape poly = (PolygonShape)shape;
          int count = poly.getVertexCount();
          Vec2[] verts = poly.getVertices();
View Full Code Here

TOP

Related Classes of org.jbox2d.collision.shapes.Shape

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.