Examples of GearJoint


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

  public Joint createJoint (JointDef def) {
    long jointAddr = createProperJoint(def);
    Joint joint = null;
    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.MotorJoint) joint = new MotorJoint(this, jointAddr);
    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);
View Full Code Here

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

    org.jbox2d.dynamics.joints.JointDef jd = def.toJBox2d();
    org.jbox2d.dynamics.joints.Joint j = world.createJoint(jd);
    Joint joint = null;
    if (def.type == JointType.DistanceJoint) joint = new DistanceJoint(this, (org.jbox2d.dynamics.joints.DistanceJoint)j);
    if (def.type == JointType.FrictionJoint) joint = new FrictionJoint(this, (org.jbox2d.dynamics.joints.FrictionJoint)j);
    if (def.type == JointType.GearJoint) joint = new GearJoint(this, (org.jbox2d.dynamics.joints.GearJoint)j, ((GearJointDef) def).joint1, ((GearJointDef) def).joint2);
    if (def.type == JointType.MotorJoint) joint = new MotorJoint(this, (org.jbox2d.dynamics.joints.MotorJoint)j);
    if (def.type == JointType.MouseJoint) joint = new MouseJoint(this, (org.jbox2d.dynamics.joints.MouseJoint)j);
    if (def.type == JointType.PrismaticJoint) joint = new PrismaticJoint(this, (org.jbox2d.dynamics.joints.PrismaticJoint)j);
    if (def.type == JointType.PulleyJoint) joint = new PulleyJoint(this, (org.jbox2d.dynamics.joints.PulleyJoint)j);
    if (def.type == JointType.RevoluteJoint) joint = new RevoluteJoint(this, (org.jbox2d.dynamics.joints.RevoluteJoint)j);
View Full Code Here

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

  public Joint createJoint (JointDef def) {
    long jointAddr = createProperJoint(def);
    Joint joint = null;
    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);
    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);
View Full Code Here

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

    org.jbox2d.dynamics.joints.JointDef jd = def.toJBox2d();
    org.jbox2d.dynamics.joints.Joint j = world.createJoint(jd);
    Joint joint = null;
    if (def.type == JointType.DistanceJoint) joint = new DistanceJoint(this, (org.jbox2d.dynamics.joints.DistanceJoint)j);
    if (def.type == JointType.FrictionJoint) joint = new FrictionJoint(this, (org.jbox2d.dynamics.joints.FrictionJoint)j);
    if (def.type == JointType.GearJoint) joint = new GearJoint(this, (org.jbox2d.dynamics.joints.GearJoint)j, ((GearJointDef) def).joint1, ((GearJointDef) def).joint2);
    if (def.type == JointType.MouseJoint) joint = new MouseJoint(this, (org.jbox2d.dynamics.joints.MouseJoint)j);
    if (def.type == JointType.PrismaticJoint) joint = new PrismaticJoint(this, (org.jbox2d.dynamics.joints.PrismaticJoint)j);
    if (def.type == JointType.PulleyJoint) joint = new PulleyJoint(this, (org.jbox2d.dynamics.joints.PulleyJoint)j);
    if (def.type == JointType.RevoluteJoint) joint = new RevoluteJoint(this, (org.jbox2d.dynamics.joints.RevoluteJoint)j);
    if (def.type == JointType.RopeJoint) joint = new RopeJoint(this, (org.jbox2d.dynamics.joints.RopeJoint)j);
View Full Code Here

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

    org.jbox2d.dynamics.joints.JointDef jd = def.toJBox2d();
    org.jbox2d.dynamics.joints.Joint j = world.createJoint(jd);
    Joint joint = null;
    if (def.type == JointType.DistanceJoint) joint = new DistanceJoint(this, (org.jbox2d.dynamics.joints.DistanceJoint)j);
    if (def.type == JointType.FrictionJoint) joint = new FrictionJoint(this, (org.jbox2d.dynamics.joints.FrictionJoint)j);
    if (def.type == JointType.GearJoint) joint = new GearJoint(this, (org.jbox2d.dynamics.joints.GearJoint)j, ((GearJointDef) def).joint1, ((GearJointDef) def).joint2);
    if (def.type == JointType.MotorJoint) joint = new MotorJoint(this, (org.jbox2d.dynamics.joints.MotorJoint)j);
    if (def.type == JointType.MouseJoint) joint = new MouseJoint(this, (org.jbox2d.dynamics.joints.MouseJoint)j);
    if (def.type == JointType.PrismaticJoint) joint = new PrismaticJoint(this, (org.jbox2d.dynamics.joints.PrismaticJoint)j);
    if (def.type == JointType.PulleyJoint) joint = new PulleyJoint(this, (org.jbox2d.dynamics.joints.PulleyJoint)j);
    if (def.type == JointType.RevoluteJoint) joint = new RevoluteJoint(this, (org.jbox2d.dynamics.joints.RevoluteJoint)j);
View Full Code Here

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

  public Joint createJoint (JointDef def) {
    long jointAddr = createProperJoint(def);
    Joint joint = null;
    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);
View Full Code Here

Examples of org.jbox2d.dynamics.joints.GearJoint

        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.