Examples of PulleyJoint


Examples of com.badlogic.gdx.physics.box2d.joints.PulleyJoint

    if (def.type == JointType.DistanceJoint) joint = new DistanceJoint(this, jointAddr);
    if (def.type == JointType.FrictionJoint) joint = new FrictionJoint(this, jointAddr);
    if (def.type == JointType.GearJoint) joint = new GearJoint(this, jointAddr, ((GearJointDef) def).joint1, ((GearJointDef) def).joint2);
    if (def.type == JointType.MouseJoint) joint = new MouseJoint(this, jointAddr);
    if (def.type == JointType.PrismaticJoint) joint = new PrismaticJoint(this, jointAddr);
    if (def.type == JointType.PulleyJoint) joint = new PulleyJoint(this, jointAddr);
    if (def.type == JointType.RevoluteJoint) joint = new RevoluteJoint(this, jointAddr);
    if (def.type == JointType.WeldJoint) joint = new WeldJoint(this, jointAddr);
    if (def.type == JointType.RopeJoint) joint = new RopeJoint(this, jointAddr);
    if (def.type == JointType.WheelJoint) joint = new WheelJoint(this, jointAddr);
    if (joint != null) joints.put(joint.addr, joint);
View Full Code Here

Examples of com.badlogic.gdx.physics.box2d.joints.PulleyJoint

    Vector2 p2 = joint.getAnchorB();

    if (joint.getType() == JointType.DistanceJoint) {
      drawSegment(p1, p2, JOINT_COLOR);
    } else if (joint.getType() == JointType.PulleyJoint) {
      PulleyJoint pulley = (PulleyJoint)joint;
      Vector2 s1 = pulley.getGroundAnchorA();
      Vector2 s2 = pulley.getGroundAnchorB();
      drawSegment(s1, p1, JOINT_COLOR);
      drawSegment(s2, p2, JOINT_COLOR);
      drawSegment(s1, s2, JOINT_COLOR);
    } else if (joint.getType() == JointType.MouseJoint) {
      drawSegment(joint.getAnchorA(), joint.getAnchorB(), JOINT_COLOR);
View Full Code Here

Examples of com.badlogic.gdx.physics.box2d.joints.PulleyJoint

    Vector2 p2 = joint.getAnchorB();

    if (joint.getType() == JointType.DistanceJoint) {
      drawSegment(p1, p2, JOINT_COLOR);
    } else if (joint.getType() == JointType.PulleyJoint) {
      PulleyJoint pulley = (PulleyJoint)joint;
      Vector2 s1 = pulley.getGroundAnchorA();
      Vector2 s2 = pulley.getGroundAnchorB();
      drawSegment(s1, p1, JOINT_COLOR);
      drawSegment(s2, p2, JOINT_COLOR);
      drawSegment(s1, s2, JOINT_COLOR);
    } else if (joint.getType() == JointType.MouseJoint) {
      drawSegment(joint.getAnchorA(), joint.getAnchorB(), JOINT_COLOR);
View Full Code Here

Examples of org.jbox2d.dynamics.joints.PulleyJoint

      case DISTANCE:
        m_debugDraw.drawSegment(p1, p2, color);
        break;

      case PULLEY: {
        PulleyJoint pulley = (PulleyJoint) joint;
        Vec2 s1 = pulley.getGroundAnchorA();
        Vec2 s2 = pulley.getGroundAnchorB();
        m_debugDraw.drawSegment(s1, p1, color);
        m_debugDraw.drawSegment(s2, p2, color);
        m_debugDraw.drawSegment(s1, s2, color);
      }
        break;
View Full Code Here

Examples of org.jbox2d.dynamics.joints.PulleyJoint

      case DISTANCE:
        m_debugDraw.drawSegment(p1, p2, color);
        break;

      case PULLEY: {
        PulleyJoint pulley = (PulleyJoint) joint;
        Vec2 s1 = pulley.getGroundAnchorA();
        Vec2 s2 = pulley.getGroundAnchorB();
        m_debugDraw.drawSegment(s1, p1, color);
        m_debugDraw.drawSegment(s2, p2, color);
        m_debugDraw.drawSegment(s1, s2, color);
      }
        break;
View Full Code Here

Examples of org.jbox2d.dynamics.joints.PulleyJoint

      case DISTANCE :
        m_debugDraw.drawSegment(p1, p2, color);
        break;
     
      case PULLEY : {
        PulleyJoint pulley = (PulleyJoint) joint;
        Vec2 s1 = pulley.getGroundAnchorA();
        Vec2 s2 = pulley.getGroundAnchorB();
        m_debugDraw.drawSegment(s1, p1, color);
        m_debugDraw.drawSegment(s2, p2, color);
        m_debugDraw.drawSegment(s1, s2, color);
      }
        break;
View Full Code Here

Examples of org.jbox2d.dynamics.joints.PulleyJoint

    case DISTANCE:
      m_debugDraw.drawSegment(p1, p2, color);
      break;

    case PULLEY: {
      PulleyJoint pulley = (PulleyJoint)joint;
      Vec2 s1 = pulley.getGroundAnchorA();
      Vec2 s2 = pulley.getGroundAnchorB();
      m_debugDraw.drawSegment(s1, p1, color);
      m_debugDraw.drawSegment(s2, p2, color);
      m_debugDraw.drawSegment(s1, s2, color);
    }
      break;
View Full Code Here

Examples of org.jbox2d.dynamics.joints.PulleyJoint

    case DISTANCE:
      m_debugDraw.drawSegment(p1, p2, color);
      break;

    case PULLEY: {
      PulleyJoint pulley = (PulleyJoint)joint;
      Vec2 s1 = pulley.getGroundAnchorA();
      Vec2 s2 = pulley.getGroundAnchorB();
      m_debugDraw.drawSegment(s1, p1, color);
      m_debugDraw.drawSegment(s2, p2, color);
      m_debugDraw.drawSegment(s1, s2, color);
    }
      break;
View Full Code Here

Examples of org.jbox2d.dynamics.joints.PulleyJoint

        builder.setFrequency(j.getFrequency());
        builder.setDampingRatio(j.getDampingRatio());
        break;
      }
      case PULLEY: {
        PulleyJoint j = (PulleyJoint) joint;
        builder.setType(PbJointType.PULLEY);
        builder.setLocalAnchorA(vecToPb(j.getLocalAnchorA()));
        builder.setLocalAnchorB(vecToPb(j.getLocalAnchorB()));
        builder.setGroundAnchorA(vecToPb(j.getGroundAnchorA()));
        builder.setGroundAnchorB(vecToPb(j.getGroundAnchorB()));
        builder.setLengthA(j.getLengthA());
        builder.setLengthB(j.getLengthB());
        builder.setRatio(j.getRatio());
        break;
      }
      case MOUSE: {
        MouseJoint j = (MouseJoint) joint;
        builder.setType(PbJointType.MOUSE);
        builder.setTarget(vecToPb(j.getTarget()));
        builder.setMaxForce(j.getMaxForce());
        builder.setFrequency(j.getFrequency());
        builder.setDampingRatio(j.getDampingRatio());
        break;
      }
      case GEAR: {
        GearJoint j = (GearJoint) joint;
        builder.setType(PbJointType.GEAR);
        builder.setRatio(j.getRatio());
        if (!argJointIndexMap.containsKey(j.getJoint1())) {
          throw new IllegalArgumentException("Joint 1 not in map");
        }
        int j1 = argJointIndexMap.get(j.getJoint1());
        if (!argJointIndexMap.containsKey(j.getJoint2())) {
          throw new IllegalArgumentException("Joint 2 not in map");
        }
        int j2 = argJointIndexMap.get(j.getJoint2());

        builder.setJoint1(j1);
        builder.setJoint2(j2);
        break;
      }
      case FRICTION: {
        FrictionJoint j = (FrictionJoint) joint;
        builder.setType(PbJointType.FRICTION);
        builder.setLocalAnchorA(vecToPb(j.getLocalAnchorA()));
        builder.setLocalAnchorB(vecToPb(j.getLocalAnchorB()));
        builder.setMaxForce(j.getMaxForce());
        builder.setMaxTorque(j.getMaxTorque());
        break;
      }
      case CONSTANT_VOLUME: {
        ConstantVolumeJoint j = (ConstantVolumeJoint) joint;
        builder.setType(PbJointType.CONSTANT_VOLUME);

        for (int i = 0; i < j.getBodies().length; i++) {
          Body b = j.getBodies()[i];
          DistanceJoint djoint = j.getJoints()[i];
          if (!argBodyIndexMap.containsKey(b)) {
            throw new IllegalArgumentException("Body " + b + " is not present in the index map");
          }
          builder.addBodies(argBodyIndexMap.get(b));
          if (!argJointIndexMap.containsKey(djoint)) {
            throw new IllegalArgumentException("Joint " + djoint
                + " is not present in the index map");
          }
          builder.addJoints(argJointIndexMap.get(djoint));
        }
        break;
      }
      case WHEEL: {
        WheelJoint j = (WheelJoint) joint;
        builder.setType(PbJointType.WHEEL);
        builder.setLocalAnchorA(vecToPb(j.getLocalAnchorA()));
        builder.setLocalAnchorB(vecToPb(j.getLocalAnchorB()));
        builder.setLocalAxisA(vecToPb(j.getLocalAxisA()));
        builder.setEnableMotor(j.isMotorEnabled());
        builder.setMaxMotorTorque(j.getMaxMotorTorque());
        builder.setMotorSpeed(j.getMotorSpeed());
        builder.setFrequency(j.getSpringFrequencyHz());
        builder.setDampingRatio(j.getSpringDampingRatio());
        break;
      }
      case ROPE: {
        RopeJoint j = (RopeJoint) joint;
        builder.setType(PbJointType.ROPE);
        builder.setLocalAnchorA(vecToPb(j.getLocalAnchorA()));
        builder.setLocalAnchorB(vecToPb(j.getLocalAnchorB()));
        builder.setMaxLength(j.getMaxLength());
        break;
      }
      case WELD: {
        WeldJoint j = (WeldJoint) joint;
        builder.setType(PbJointType.WELD);
        builder.setLocalAnchorA(vecToPb(j.getLocalAnchorA()));
        builder.setLocalAnchorB(vecToPb(j.getLocalAnchorB()));
        builder.setRefAngle(j.getReferenceAngle());
        builder.setFrequency(j.getFrequency());
        builder.setDampingRatio(j.getDampingRatio());
        break;
      }
      default:
        UnsupportedObjectException e = new UnsupportedObjectException("Unknown joint type: "
            + joint.getType(), Type.JOINT);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.