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

项目:homescreenarcade    文件:FlipperElement.java   
@Override public void createBodies(World world) {
    this.anchorBody = Box2DFactory.createCircle(world, this.cx, this.cy, 0.05f, true);
    // Joint angle is 0 when flipper is horizontal.
    // The flipper needs to be slightly extended past anchorBody to rotate correctly.
    float ext = (this.flipperLength > 0) ? -0.05f : +0.05f;
    // Width larger than 0.12 slows rotation?
    this.flipperBody = Box2DFactory.createWall(world, cx+ext, cy-0.12f, cx+flipperLength, cy+0.12f, 0f);
    flipperBody.setType(BodyDef.BodyType.DynamicBody);
    flipperBody.setBullet(true);
    flipperBody.getFixtureList().get(0).setDensity(5.0f);

    jointDef = new RevoluteJointDef();
    jointDef.initialize(anchorBody, flipperBody, new Vector2(this.cx, this.cy));
    jointDef.enableLimit = true;
    jointDef.enableMotor = true;
    // counterclockwise rotations are positive, so flip angles for flippers extending left
    jointDef.lowerAngle = (this.flipperLength>0) ? this.minangle : -this.maxangle;
    jointDef.upperAngle = (this.flipperLength>0) ? this.maxangle : -this.minangle;
    jointDef.maxMotorTorque = 1000f;

    this.joint = (RevoluteJoint)world.createJoint(jointDef);

    flipperBodySet = Collections.singletonList(flipperBody);
    this.setEffectiveMotorSpeed(-this.downspeed); // Force flipper to bottom when field is first created.
}
项目:feup-lpoo-armadillo    文件:B2DFactory.java   
/**
 * Creates a pivoted platform from the given object, at the given world.
 *
 * @param world  The world were the platform will be.
 * @param object The object used to initialize the platform.
 * @return The Platform Model of the created platform.
 */
static PlatformModel makePlatform(World world, RectangleMapObject object) {
    PlatformModel platform = new PlatformModel(world, object);

    Boolean pivoted = object.getProperties().get("pivoted", boolean.class);
    if (pivoted != null && pivoted == true) {
        Rectangle rect = object.getRectangle();
        RectangleMapObject anchorRect = new RectangleMapObject(
                rect.getX() + rect.getWidth() / 2, rect.getY() + rect.getHeight() / 2, 1, 1
        );
        Body anchor = makeRectGround(world, anchorRect);

        RevoluteJointDef jointDef = new RevoluteJointDef();
        jointDef.initialize(anchor, platform.getBody(), platform.getBody().getWorldCenter());
        world.createJoint(jointDef);
    }

    return platform;
}
项目:GDX-Engine    文件:PhysicsManager.java   
/**
    * create Revolute Joint
    */
   public RevoluteJoint createRevoluteJoint(Body bodyA, Body bodyB,
    Vector2 jointPositionA, Vector2 jointPositionB,
    boolean enabledMotor, int maxMotorTorque, int motorSpeed) {
RevoluteJointDef rJoint = new RevoluteJointDef();
rJoint.bodyA = bodyA;
rJoint.bodyB = bodyB;
rJoint.localAnchorA.set(jointPositionA.x * WORLD_TO_BOX,
    jointPositionA.y * WORLD_TO_BOX);
rJoint.localAnchorB.set(jointPositionB.x * WORLD_TO_BOX,
    jointPositionB.y * WORLD_TO_BOX);

rJoint.enableMotor = enabledMotor;
rJoint.maxMotorTorque = maxMotorTorque;
rJoint.motorSpeed = motorSpeed;

RevoluteJoint joint = (RevoluteJoint) world.createJoint(rJoint);
return joint;
   }
项目:GDX-Engine    文件:PhysicsTiledScene.java   
/**
 * create Revolute Joint
 */
public RevoluteJoint createRevoluteJoint(Body bodyA, Body bodyB,
        Vector2 jointPositionA, Vector2 jointPositionB,
        boolean enabledMotor, int maxMotorTorque, int motorSpeed) {
    RevoluteJointDef rJoint = new RevoluteJointDef();
    rJoint.bodyA = bodyA;
    rJoint.bodyB = bodyB;
    rJoint.localAnchorA.set(jointPositionA.x * WORLD_TO_BOX,
            jointPositionA.y * WORLD_TO_BOX);
    rJoint.localAnchorB.set(jointPositionB.x * WORLD_TO_BOX,
            jointPositionB.y * WORLD_TO_BOX);

    rJoint.enableMotor = enabledMotor;
    rJoint.maxMotorTorque = maxMotorTorque;
    rJoint.motorSpeed = motorSpeed;

    RevoluteJoint joint = (RevoluteJoint) world.createJoint(rJoint);
    return joint;
}
项目:Vector-Pinball-Editor    文件:FlipperElement.java   
@Override public void createBodies(World world) {
    this.anchorBody = Box2DFactory.createCircle(world, this.cx, this.cy, 0.05f, true);
    // Joint angle is 0 when flipper is horizontal.
    // The flipper needs to be slightly extended past anchorBody to rotate correctly.
    float ext = (this.flipperLength > 0) ? -0.05f : +0.05f;
    // Width larger than 0.12 slows rotation?
    this.flipperBody = Box2DFactory.createWall(world, cx+ext, cy-0.12f, cx+flipperLength, cy+0.12f, 0f);
    flipperBody.setType(BodyDef.BodyType.DynamicBody);
    flipperBody.setBullet(true);
    flipperBody.getFixtureList().get(0).setDensity(5.0f);

    jointDef = new RevoluteJointDef();
    jointDef.initialize(anchorBody, flipperBody, new Vector2(this.cx, this.cy));
    jointDef.enableLimit = true;
    jointDef.enableMotor = true;
    // counterclockwise rotations are positive, so flip angles for flippers extending left
    jointDef.lowerAngle = (this.flipperLength>0) ? this.minangle : -this.maxangle;
    jointDef.upperAngle = (this.flipperLength>0) ? this.maxangle : -this.minangle;
    jointDef.maxMotorTorque = 1000f;

    this.joint = (RevoluteJoint)world.createJoint(jointDef);

    flipperBodySet = Collections.singletonList(flipperBody);
    this.setEffectiveMotorSpeed(-this.downspeed); // Force flipper to bottom when field is first created.
}
项目:NicolasRage    文件:BeeMan.java   
public BeeMan(World world, float x, float y, float width)
{
    super(beeTextures[0], world, x, y, width);
    leftArm = new Actor(beeTextures[1], null, world, x - (getWidth()*2f/3), y + getHeight()/8, 1);
    this.actors.add(leftArm);
    RevoluteJointDef leftArmJointDef = new RevoluteJointDef();
    leftArmJointDef.collideConnected = false;
    leftArmJointDef.initialize(this.body, leftArm.body, new Vector2(x - (getWidth() / 6), y + getHeight() / 8));
    world.createJoint(leftArmJointDef);

    Actor rightArm = new Actor(beeTextures[2], null, world, x + (getWidth()*2f/3), y + getHeight()/8, 1);
    this.actors.add(rightArm);
    RevoluteJointDef rightArmJointDef = new RevoluteJointDef();
    rightArmJointDef.collideConnected = false;
    rightArmJointDef.initialize(this.body, rightArm.body, new Vector2(x + (getWidth() / 6), y + getHeight() / 8));
    world.createJoint(rightArmJointDef);


}
项目:old48_30_game    文件:GameScreen.java   
private Player createPlayer(World world, Cable cable) {
    CircleShape playerShape = new CircleShape();
    playerShape.setRadius(Constants.PLAYER_WIDTH / 2);
    PhysicsModel playerModel = new PhysicsModel(world, 0, 5, playerShape,
            true, BodyDef.BodyType.DynamicBody, 0.1f);
    Player player = new Player(playerModel);

    RevoluteJointDef jointDef = new RevoluteJointDef();
    jointDef.bodyA = player.getBody();
    jointDef.bodyB = cable.getBodyList().get(0);
    world.createJoint(jointDef);

    WeldJointDef weldJointDef = new WeldJointDef();
    weldJointDef.bodyA = player.getBody();
    weldJointDef.bodyB = cable.getBodyList().get(
            cable.getBodyList().size() - 1);
    weldJointDef.localAnchorA.set(-30, 8);
    world.createJoint(weldJointDef);

    return player;
}
项目:Blob-Game    文件:ChainLink.java   
@Override
public void postLoad() {
    Actor targetActor = getLevel().getActorById(Convert.getInt(getProp("HangingTarget")));
    if (targetActor == null) {
        return;
    }
    Body targetBody = targetActor.getMainBody();
    if (targetBody != mAnchor) {
        mAnchor = targetBody;
        if (targetBody != null) {
            if (mJoint != null) {
                getLevel().getWorld().destroyJoint(mJoint);
                mJoint = null;
            }
            RevoluteJointDef rjd = new RevoluteJointDef();
            rjd.enableLimit = true;
            rjd.collideConnected = false;
            Vector2 rot = new Vector2(0, 0);
            rot.rotate((float) (Convert.getFloat(getProp("Angle")) * 180 / Math.PI));
            rjd.initialize(mBody, mAnchor, new Vector2(getX() + rot.x, getY() + rot.y));
            mJoint = getLevel().getWorld().createJoint(rjd);
        }
    }
}
项目:Blob-Game    文件:SwingingCan.java   
@Override
public void postLoad() {
    Actor targetActor = getLevel().getActorById(Convert.getInt(getProp("HangingTarget")));
    if (targetActor == null) {
        return;
    }
    Body targetBody = targetActor.getMainBody();
    mAnchor = targetBody;
    if (targetBody != null) {
        RevoluteJointDef rjd = new RevoluteJointDef();
        rjd.collideConnected = false;
        Vector2 rot = new Vector2(0, 1.0f);
        rot.rotate((float) (Convert.getFloat(getProp("Angle"))));
        rjd.initialize(mBody, mAnchor, new Vector2(getX() + rot.x, getY() + rot.y));
        mJoint = getLevel().getWorld().createJoint(rjd);
    }

}
项目:Blob-Game    文件:HookForCan.java   
@Override
public void postLoad() {
    Actor targetActor = getLevel().getActorById(Convert.getInt(getProp("HangingTarget")));
    if (targetActor == null) {
        return;
    }
    Body targetBody = targetActor.getMainBody();
    if (targetBody != mAnchor) {
        mAnchor = targetBody;
        if (targetBody != null) {
            if (mJoint != null) {
                getLevel().getWorld().destroyJoint(mJoint);
                mJoint = null;
            }
            RevoluteJointDef rjd = new RevoluteJointDef();
            rjd.collideConnected = false;
            Vector2 rot = new Vector2(0, 0);
            rot.rotate((float) (Convert.getFloat(getProp("Angle")) * 180 / Math.PI));
            rjd.initialize(mBody, mAnchor, new Vector2(getX() + rot.x, getY() + rot.y));
            mJoint = getLevel().getWorld().createJoint(rjd);
        }
    }
}
项目: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 RevoluteJointDef read(Json json, JsonValue jsonData, Class type)
{   
    RevoluteJointDef defaults = RubeDefaults.Joint.revoluteDef;

    RevoluteJointDef def = new RevoluteJointDef();

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

    if(anchorA != null && anchorB != null)
    {
        def.localAnchorA.set(anchorA);
        def.localAnchorB.set(anchorB);
        def.referenceAngle  = json.readValue("refAngle",        float.class, defaults.referenceAngle, jsonData);
        def.enableLimit     = json.readValue("enableLimit",     boolean.class, defaults.enableLimit, jsonData);
        def.lowerAngle      = json.readValue("lowerLimit",      float.class, defaults.lowerAngle, jsonData);
        def.upperAngle      = json.readValue("upperLimit",      float.class, defaults.upperAngle, jsonData);
        def.enableMotor     = json.readValue("enableMotor",     boolean.class, defaults.enableMotor, jsonData);
        def.motorSpeed      = json.readValue("motorSpeed",      float.class, defaults.motorSpeed, jsonData);
        def.maxMotorTorque  = json.readValue("maxMotorTorque",  float.class, defaults.maxMotorTorque, jsonData);
    }

    return def; 
}
项目:liblol    文件:WorldActor.java   
/**
 * Create a revolute joint between this actor and some other actor. Note that both actors need
 * to have some mass (density can't be 0) or else this won't work.
 *
 * @param anchor       The actor around which this actor will rotate
 * @param anchorX      The X coordinate (relative to center) where joint fuses to the anchor
 * @param anchorY      The Y coordinate (relative to center) where joint fuses to the anchor
 * @param localAnchorX The X coordinate (relative to center) where joint fuses to this actor
 * @param localAnchorY The Y coordinate (relative to center) where joint fuses to this actor
 */
public void setRevoluteJoint(WorldActor anchor, float anchorX, float anchorY,
                             float localAnchorX, float localAnchorY) {
    // make the body dynamic
    setCanFall();
    // create joint, connect anchors
    mRevJointDef = new RevoluteJointDef();
    mRevJointDef.bodyA = anchor.mBody;
    mRevJointDef.bodyB = mBody;
    mRevJointDef.localAnchorA.set(anchorX, anchorY);
    mRevJointDef.localAnchorB.set(localAnchorX, localAnchorY);
    // rotator and anchor don't collide
    mRevJointDef.collideConnected = false;
    mRevJointDef.referenceAngle = 0;
    mRevJointDef.enableLimit = false;
    mRevJoint = mScene.mWorld.createJoint(mRevJointDef);
}
项目:Android-Genetic-Cars    文件:CarFactory.java   
/**
 * Attaches the provided wheels to the specified chassis using
 * motorized joints.
 *
 * @param world       the world in which the assembly takes place
 * @param chassis     the chassis of the car to mount the wheels to
 * @param vertexes    the array of vertexes used to assemble the car
 * @param wheelBodies the box2d wheel body objects to mount to the car
 * @param wheelDefs   the definitions used to create the wheel bodies
 */
private static void attachWheels(World world, Body chassis, Vector2[] vertexes, Body[] wheelBodies, Wheel[] wheelDefs) {
    // Calculate the total mass of the chassis and the wheels
    double totalMass = chassis.getMass();
    for (Body wheelBody : wheelBodies)
        totalMass += wheelBody.getMass();

    // For each wheel provided create a motorized joint linking the wheel and the chassis
    for (int i = 0; i < wheelBodies.length; i++) {
        RevoluteJointDef jointDef = new RevoluteJointDef();
        Vector2 vertex = vertexes[wheelDefs[i].getVertex()];
        jointDef.localAnchorA.set(vertex.x, vertex.y);
        jointDef.localAnchorB.set(0, 0);

        jointDef.maxMotorTorque = (float) (totalMass * -world.getGravity().y / wheelDefs[i].getRadius());
        jointDef.motorSpeed = -MOTOR_SPEED;
        jointDef.enableMotor = true;
        jointDef.bodyA = chassis;
        jointDef.bodyB = wheelBodies[i];

        world.createJoint(jointDef);
    }
}
项目:GDX-Engine    文件:PhysicsManager.java   
public RevoluteJoint createRevoluteJoint(Body bodyA, Body bodyB,
    Vector2 jointPositionA, Vector2 jointPositionB) {
RevoluteJointDef rJoint = new RevoluteJointDef();
rJoint.bodyA = bodyA;
rJoint.bodyB = bodyB;
rJoint.localAnchorA.set(jointPositionA.x * WORLD_TO_BOX,
    jointPositionA.y * WORLD_TO_BOX);
rJoint.localAnchorB.set(jointPositionB.x * WORLD_TO_BOX,
    jointPositionB.y * WORLD_TO_BOX);
RevoluteJoint joint = (RevoluteJoint) world.createJoint(rJoint);
return joint;
   }
项目:GDX-Engine    文件:PhysicsTiledScene.java   
public RevoluteJoint createRevoluteJoint(Body bodyA, Body bodyB,
        Vector2 jointPositionA, Vector2 jointPositionB) {
    RevoluteJointDef rJoint = new RevoluteJointDef();
    rJoint.bodyA = bodyA;
    rJoint.bodyB = bodyB;
    rJoint.localAnchorA.set(jointPositionA.x * WORLD_TO_BOX,
            jointPositionA.y * WORLD_TO_BOX);
    rJoint.localAnchorB.set(jointPositionB.x * WORLD_TO_BOX,
            jointPositionB.y * WORLD_TO_BOX);
    RevoluteJoint joint = (RevoluteJoint) world.createJoint(rJoint);
    return joint;
}
项目:cgc-game    文件:BodyFactory.java   
public void createRevoluteJoint(Body b1, Body b2, Vector2 a1, Vector2 a2)
{
    RevoluteJointDef rjd = new RevoluteJointDef();
    rjd.localAnchorA.set(a1);
    rjd.localAnchorB.set(a2);
    rjd.bodyA = b1;
    rjd.bodyB = b2;
    world.createJoint(rjd);
}
项目:old48_30_game    文件:Cable.java   
public Cable(World world, Vector2 startPos, float segmentLength, int segmentCount) {
    this.segmentLength = segmentLength;
    this.segmentThick = 0.5f;

    bodyList = new ArrayList<Body>(segmentCount);
    jointList = new ArrayList<Joint>(segmentCount + 1);  // we need joints at ends of cable;

    for (int i = 0; i < segmentCount; i++) {
        CircleShape segmentShape = new CircleShape();
        segmentShape.setRadius(segmentThick / 2);

        PhysicsModel segmentPhysicsModel = new PhysicsModel(world, (startPos.x - i * segmentLength), startPos.y,
                segmentShape, false, BodyDef.BodyType.DynamicBody, 0.01f);
        Block segment = new Block(segmentPhysicsModel);
        bodyList.add(segment.getBody());

        if (i > 0) {
            RevoluteJointDef revoluteJointDef = new RevoluteJointDef();
            revoluteJointDef.bodyA = segmentPhysicsModel.getBody();
            revoluteJointDef.bodyB = bodyList.get(i - 1);
            revoluteJointDef.collideConnected = false;
            revoluteJointDef.localAnchorA.set(0, segmentLength);

            Joint joint = world.createJoint(revoluteJointDef);
        }
    }
}
项目:libgdx-demo-vector-pinball    文件:FlipperElement.java   
@Override
public void finishCreate (Map params, World world) {
    List pos = (List)params.get("position");

    this.cx = asFloat(pos.get(0));
    this.cy = asFloat(pos.get(1));
    this.flipperLength = asFloat(params.get("length"));
    this.minangle = toRadians(asFloat(params.get("minangle")));
    this.maxangle = toRadians(asFloat(params.get("maxangle")));
    this.upspeed = asFloat(params.get("upspeed"));
    this.downspeed = asFloat(params.get("downspeed"));

    this.anchorBody = Box2DFactory.createCircle(world, this.cx, this.cy, 0.05f, true);
    // joint angle is 0 when flipper is horizontal
    // flipper needs to be slightly extended past anchorBody to rotate correctly
    float ext = (this.flipperLength > 0) ? -0.05f : +0.05f;
    // width larger than 0.12 slows rotation?
    this.flipperBody = Box2DFactory.createWall(world, cx + ext, cy - 0.12f, cx + flipperLength, cy + 0.12f, 0f);
    flipperBody.setType(BodyDef.BodyType.DynamicBody);
    flipperBody.setBullet(true);
    flipperBody.getFixtureList().get(0).setDensity(5.0f);

    jointDef = new RevoluteJointDef();
    jointDef.initialize(anchorBody, flipperBody, new Vector2(this.cx, this.cy));
    jointDef.enableLimit = true;
    jointDef.enableMotor = true;
    // counterclockwise rotations are positive, so flip angles for flippers extending left
    jointDef.lowerAngle = (this.flipperLength > 0) ? this.minangle : -this.maxangle;
    jointDef.upperAngle = (this.flipperLength > 0) ? this.maxangle : -this.minangle;
    jointDef.maxMotorTorque = 1000f;

    this.joint = (RevoluteJoint)world.createJoint(jointDef);

    flipperBodySet = Collections.singleton(flipperBody);
    this.setEffectiveMotorSpeed(-this.downspeed); // force flipper to bottom when field is first created
}
项目:SuperSumo    文件:FlipperElement.java   
@Override
public void finishCreate (Map params, World world) {
    List pos = (List)params.get("position");

    this.cx = asFloat(pos.get(0));
    this.cy = asFloat(pos.get(1));
    this.flipperLength = asFloat(params.get("length"));
    this.minangle = toRadians(asFloat(params.get("minangle")));
    this.maxangle = toRadians(asFloat(params.get("maxangle")));
    this.upspeed = asFloat(params.get("upspeed"));
    this.downspeed = asFloat(params.get("downspeed"));

    this.anchorBody = Box2DFactory.createCircle(world, this.cx, this.cy, 0.05f, true, 1);
    // joint angle is 0 when flipper is horizontal
    // flipper needs to be slightly extended past anchorBody to rotate correctly
    float ext = (this.flipperLength > 0) ? -0.05f : +0.05f;
    // width larger than 0.12 slows rotation?
    this.flipperBody = Box2DFactory.createWall(world, cx + ext, cy - 0.12f, cx + flipperLength, cy + 0.12f, 0f);
    flipperBody.setType(BodyDef.BodyType.DynamicBody);
    flipperBody.setBullet(true);
    flipperBody.getFixtureList().get(0).setDensity(5.0f);

    jointDef = new RevoluteJointDef();
    jointDef.initialize(anchorBody, flipperBody, new Vector2(this.cx, this.cy));
    jointDef.enableLimit = true;
    jointDef.enableMotor = true;
    // counterclockwise rotations are positive, so flip angles for flippers extending left
    jointDef.lowerAngle = (this.flipperLength > 0) ? this.minangle : -this.maxangle;
    jointDef.upperAngle = (this.flipperLength > 0) ? this.maxangle : -this.minangle;
    jointDef.maxMotorTorque = 1000f;

    this.joint = (RevoluteJoint)world.createJoint(jointDef);

    flipperBodySet = Collections.singleton(flipperBody);
    this.setEffectiveMotorSpeed(-this.downspeed); // force flipper to bottom when field is first created
}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
/**
 * Creates the joint.
 * @return  This joint. Handy for chaining stuff together.
 */
@Override
public B2FlxRevoluteJoint create()
{
    ((RevoluteJointDef)jointDef).initialize(bodyA, bodyB, anchorA);
    joint = B2FlxB.world.createJoint(jointDef);
    return this;
}
项目:radial    文件:RevoluteJointConfig.java   
@Override
public JointDef createDef(Body sourceBody, Body targetBody, final Vector2 targetOffset) {


  RevoluteJointDef jointDef = new RevoluteJointDef() {{
    enableLimit = false;
  }};

  Vector2 worldTarget = new Vector2(targetBody.getWorldCenter()).add(targetOffset);
  jointDef.initialize(sourceBody, targetBody, worldTarget);
  return jointDef;
}
项目:angr    文件:Hans.java   
private void createHandJoint(World world, _ModelData a, Vector2 anchorA, _ModelData b, Vector2 anchorB, float refAngle) {
    RevoluteJointDef jointDef = new RevoluteJointDef();
    jointDef.initialize(a.body, b.body, hbody.body.getWorldCenter());
    jointDef.lowerAngle = -0.5f * MathUtils.PI; // -90 degrees
    jointDef.upperAngle = 0.25f * MathUtils.PI; // 45 degrees
    jointDef.referenceAngle = refAngle;
    jointDef.enableLimit = true;
    jointDef.maxMotorTorque = 0.5f;
    jointDef.motorSpeed = 0.0f;
    jointDef.enableMotor = true;
    jointDef.localAnchorA.set(anchorA);
    jointDef.localAnchorB.set(anchorB);

    world.createJoint(jointDef);
}
项目:angr    文件:Hans.java   
public void setPalmJoint(Body obj) {
    this.objPalm = obj;

    RevoluteJointDef jointDef = new RevoluteJointDef();
    jointDef.initialize(hand_l.body, obj, hand_l.bodyOrigin);
    jointDef.enableLimit = false;
    jointDef.maxMotorTorque = 0.5f;
    jointDef.motorSpeed = 0.0f;
    jointDef.enableMotor = true;
    jointDef.localAnchorA.set(new Vector2(0.8f, 0.0f));
    jointDef.localAnchorB.set(new Vector2(0.0f, 0.0f));

    palmJoint = obj.getWorld().createJoint(jointDef);
}
项目:KillTheNerd    文件:BodyFactory.java   
public static Joint createJoint(final Body bodyA, final Body bodyB) {
    final RevoluteJointDef joint = new RevoluteJointDef();
    joint.bodyA = bodyA;
    joint.bodyB = bodyB;
    return BodyFactory.world.createJoint(joint);
}
项目:GDX-Logic-Bricks    文件:RevoluteJointBuilder.java   
@Override
public void reset() {
    jointDef = new RevoluteJointDef();

}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
public B2FlxRevoluteJoint setEnableLimit(boolean enableLimit)
{
    ((RevoluteJointDef)jointDef).enableLimit = enableLimit;
    return this;
}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
public B2FlxRevoluteJoint setEnableMotor(boolean enableMotor)
{
    ((RevoluteJointDef)jointDef).enableMotor = enableMotor;
    return this;
}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
public B2FlxRevoluteJoint setMotorSpeed(float motorSpeed)
{
    ((RevoluteJointDef)jointDef).motorSpeed = motorSpeed;
    return this;
}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
public B2FlxRevoluteJoint setMaxMotorTorque(float maxMotorTorque)
{
    ((RevoluteJointDef)jointDef).maxMotorTorque = maxMotorTorque;
    return this;
}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
public B2FlxRevoluteJoint setUpperAngle(float upperAngle)
{
    ((RevoluteJointDef)jointDef).upperAngle = upperAngle * B2FlxMath.DEGRAD;
    return this;
}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
public B2FlxRevoluteJoint setLowerAngle(float lowerAngle)
{
    ((RevoluteJointDef)jointDef).lowerAngle = lowerAngle * B2FlxMath.DEGRAD;
    return this;
}
项目: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;
}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
/**
 * Creates a revolute joint.
 * @param spriteA   The first body.
 * @param spriteB   The second body.
 * @param jointDef  The joint definition.
 */
public B2FlxRevoluteJoint(B2FlxShape spriteA, B2FlxShape spriteB, RevoluteJointDef jointDef)
{
    super(spriteA, spriteB, jointDef);
}