Java 类com.badlogic.gdx.physics.box2d.joints.PulleyJointDef 实例源码

项目:RubeLoader    文件:JointSerializer.java   
public JointSerializer(RubeScene scene,Json _json)
{
    this.scene = scene;
    _json.setSerializer(RevoluteJointDef.class,     new RevoluteJointDefSerializer());
    _json.setSerializer(PrismaticJointDef.class,    new PrismaticJointDefSerializer());
    _json.setSerializer(PulleyJointDef.class,       new PulleyJointDefSerializer());
    _json.setSerializer(WeldJointDef.class,         new WeldJointDefSerializer());
    _json.setSerializer(FrictionJointDef.class,     new FrictionJointDefSerializer());
    _json.setSerializer(WheelJointDef.class,        new WheelJointDefSerializer());
    _json.setSerializer(RopeJointDef.class,         new RopeJointDefSerializer());
    _json.setSerializer(DistanceJointDef.class,     new DistanceJointDefSerializer());
    _json.setSerializer(GearJointDef.class,         new GearJointDefSerializer());

    mouseJointDefSerializer = new MouseJointDefSerializer();

    _json.setSerializer(MouseJointDef.class,        mouseJointDefSerializer);
}
项目:RubeLoader    文件:JointSerializer.java   
@SuppressWarnings("rawtypes")
@Override
public PulleyJointDef read(Json json, JsonValue jsonData, Class type)
{   
    PulleyJointDef defaults = RubeDefaults.Joint.pulleyDef;

    PulleyJointDef def = new PulleyJointDef();

    Vector2 anchorA = json.readValue("anchorA", Vector2.class, defaults.localAnchorA, jsonData);
    Vector2 anchorB = json.readValue("anchorB", Vector2.class, defaults.localAnchorB, jsonData);

    Vector2 groundAnchorA = json.readValue("groundAnchorA", Vector2.class, defaults.groundAnchorA, jsonData);
    Vector2 groundAnchorB = json.readValue("groundAnchorB", Vector2.class, defaults.groundAnchorB, jsonData);

    if(anchorA != null && anchorB != null && groundAnchorA != null && groundAnchorB !=null)
    {
        def.localAnchorA.set(anchorA);
        def.localAnchorB.set(anchorB);
        defaults.groundAnchorA.set(groundAnchorA);
        defaults.groundAnchorB.set(groundAnchorB);

        def.lengthA     = json.readValue("lengthA", float.class,    defaults.lengthA,   jsonData);
        def.lengthB     = json.readValue("lengthB", float.class,    defaults.lengthB,   jsonData);
        def.ratio       = json.readValue("ratio",   float.class,    defaults.ratio,     jsonData);
    }

    return def; 
}
项目:flixel-gdx-box2d    文件:B2FlxPulleyJoint.java   
/**
 * Creates a pulley joint.
 * @param spriteA   The first body.
 * @param spriteB   The second body.
 * @param jointDef  The joint definition.
 */
public B2FlxPulleyJoint(B2FlxShape spriteA, B2FlxShape spriteB, PulleyJointDef jointDef)
{
    super(spriteA, spriteB, jointDef);
    anchorA = bodyA.getWorldCenter();
    anchorB = bodyB.getWorldCenter();
}
项目:flixel-gdx-box2d    文件:B2FlxPulleyJoint.java   
/**
 * Creates the joint.
 * @return  This joint. Handy for chaining stuff together.
 */
@Override
public B2FlxPulleyJoint create()
{
    ((PulleyJointDef) jointDef).initialize(bodyA, bodyB, _groundAnchorA, _groundAnchorB, anchorA, anchorB, _ratio);
    joint = B2FlxB.world.createJoint(jointDef);
    return this;
}
项目:GDX-Logic-Bricks    文件:PulleyJointBuilder.java   
@Override
public void reset() {
    jointDef = new PulleyJointDef();

}
项目:ingress-indonesia-dev    文件:World.java   
private long createProperJoint(JointDef paramJointDef)
{
  if (paramJointDef.type == JointDef.JointType.DistanceJoint)
  {
    DistanceJointDef localDistanceJointDef = (DistanceJointDef)paramJointDef;
    return jniCreateDistanceJoint(this.addr, localDistanceJointDef.bodyA.addr, localDistanceJointDef.bodyB.addr, localDistanceJointDef.collideConnected, localDistanceJointDef.localAnchorA.x, localDistanceJointDef.localAnchorA.y, localDistanceJointDef.localAnchorB.x, localDistanceJointDef.localAnchorB.y, localDistanceJointDef.length, localDistanceJointDef.frequencyHz, localDistanceJointDef.dampingRatio);
  }
  if (paramJointDef.type == JointDef.JointType.FrictionJoint)
  {
    FrictionJointDef localFrictionJointDef = (FrictionJointDef)paramJointDef;
    return jniCreateFrictionJoint(this.addr, localFrictionJointDef.bodyA.addr, localFrictionJointDef.bodyB.addr, localFrictionJointDef.collideConnected, localFrictionJointDef.localAnchorA.x, localFrictionJointDef.localAnchorA.y, localFrictionJointDef.localAnchorB.x, localFrictionJointDef.localAnchorB.y, localFrictionJointDef.maxForce, localFrictionJointDef.maxTorque);
  }
  if (paramJointDef.type == JointDef.JointType.GearJoint)
  {
    GearJointDef localGearJointDef = (GearJointDef)paramJointDef;
    return jniCreateGearJoint(this.addr, localGearJointDef.bodyA.addr, localGearJointDef.bodyB.addr, localGearJointDef.collideConnected, localGearJointDef.joint1.addr, localGearJointDef.joint2.addr, localGearJointDef.ratio);
  }
  if (paramJointDef.type == JointDef.JointType.MouseJoint)
  {
    MouseJointDef localMouseJointDef = (MouseJointDef)paramJointDef;
    return jniCreateMouseJoint(this.addr, localMouseJointDef.bodyA.addr, localMouseJointDef.bodyB.addr, localMouseJointDef.collideConnected, localMouseJointDef.target.x, localMouseJointDef.target.y, localMouseJointDef.maxForce, localMouseJointDef.frequencyHz, localMouseJointDef.dampingRatio);
  }
  if (paramJointDef.type == JointDef.JointType.PrismaticJoint)
  {
    PrismaticJointDef localPrismaticJointDef = (PrismaticJointDef)paramJointDef;
    return jniCreatePrismaticJoint(this.addr, localPrismaticJointDef.bodyA.addr, localPrismaticJointDef.bodyB.addr, localPrismaticJointDef.collideConnected, localPrismaticJointDef.localAnchorA.x, localPrismaticJointDef.localAnchorA.y, localPrismaticJointDef.localAnchorB.x, localPrismaticJointDef.localAnchorB.y, localPrismaticJointDef.localAxisA.x, localPrismaticJointDef.localAxisA.y, localPrismaticJointDef.referenceAngle, localPrismaticJointDef.enableLimit, localPrismaticJointDef.lowerTranslation, localPrismaticJointDef.upperTranslation, localPrismaticJointDef.enableMotor, localPrismaticJointDef.maxMotorForce, localPrismaticJointDef.motorSpeed);
  }
  if (paramJointDef.type == JointDef.JointType.PulleyJoint)
  {
    PulleyJointDef localPulleyJointDef = (PulleyJointDef)paramJointDef;
    return jniCreatePulleyJoint(this.addr, localPulleyJointDef.bodyA.addr, localPulleyJointDef.bodyB.addr, localPulleyJointDef.collideConnected, localPulleyJointDef.groundAnchorA.x, localPulleyJointDef.groundAnchorA.y, localPulleyJointDef.groundAnchorB.x, localPulleyJointDef.groundAnchorB.y, localPulleyJointDef.localAnchorA.x, localPulleyJointDef.localAnchorA.y, localPulleyJointDef.localAnchorB.x, localPulleyJointDef.localAnchorB.y, localPulleyJointDef.lengthA, localPulleyJointDef.lengthB, localPulleyJointDef.ratio);
  }
  if (paramJointDef.type == JointDef.JointType.RevoluteJoint)
  {
    RevoluteJointDef localRevoluteJointDef = (RevoluteJointDef)paramJointDef;
    return jniCreateRevoluteJoint(this.addr, localRevoluteJointDef.bodyA.addr, localRevoluteJointDef.bodyB.addr, localRevoluteJointDef.collideConnected, localRevoluteJointDef.localAnchorA.x, localRevoluteJointDef.localAnchorA.y, localRevoluteJointDef.localAnchorB.x, localRevoluteJointDef.localAnchorB.y, localRevoluteJointDef.referenceAngle, localRevoluteJointDef.enableLimit, localRevoluteJointDef.lowerAngle, localRevoluteJointDef.upperAngle, localRevoluteJointDef.enableMotor, localRevoluteJointDef.motorSpeed, localRevoluteJointDef.maxMotorTorque);
  }
  if (paramJointDef.type == JointDef.JointType.WeldJoint)
  {
    WeldJointDef localWeldJointDef = (WeldJointDef)paramJointDef;
    return jniCreateWeldJoint(this.addr, localWeldJointDef.bodyA.addr, localWeldJointDef.bodyB.addr, localWeldJointDef.collideConnected, localWeldJointDef.localAnchorA.x, localWeldJointDef.localAnchorA.y, localWeldJointDef.localAnchorB.x, localWeldJointDef.localAnchorB.y, localWeldJointDef.referenceAngle);
  }
  if (paramJointDef.type == JointDef.JointType.RopeJoint)
  {
    RopeJointDef localRopeJointDef = (RopeJointDef)paramJointDef;
    return jniCreateRopeJoint(this.addr, localRopeJointDef.bodyA.addr, localRopeJointDef.bodyB.addr, localRopeJointDef.collideConnected, localRopeJointDef.localAnchorA.x, localRopeJointDef.localAnchorA.y, localRopeJointDef.localAnchorB.x, localRopeJointDef.localAnchorB.y, localRopeJointDef.maxLength);
  }
  if (paramJointDef.type == JointDef.JointType.WheelJoint)
  {
    WheelJointDef localWheelJointDef = (WheelJointDef)paramJointDef;
    return jniCreateWheelJoint(this.addr, localWheelJointDef.bodyA.addr, localWheelJointDef.bodyB.addr, localWheelJointDef.collideConnected, localWheelJointDef.localAnchorA.x, localWheelJointDef.localAnchorA.y, localWheelJointDef.localAnchorB.x, localWheelJointDef.localAnchorB.y, localWheelJointDef.localAxisA.x, localWheelJointDef.localAxisA.y, localWheelJointDef.enableMotor, localWheelJointDef.maxMotorTorque, localWheelJointDef.motorSpeed, localWheelJointDef.frequencyHz, localWheelJointDef.dampingRatio);
  }
  return 0L;
}