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

项目:libgdxcn    文件:WheelJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.WheelJointDef fd = new org.jbox2d.dynamics.joints.WheelJointDef();
    fd.bodyA = bodyA.body;
    fd.bodyB = bodyB.body;
    fd.collideConnected = collideConnected;
    fd.localAxisA.set(localAxisA.x, localAxisA.y);
    fd.enableMotor = enableMotor;
    fd.maxMotorTorque = maxMotorTorque;
    fd.motorSpeed = motorSpeed;
    fd.frequencyHz = frequencyHz;
    fd.dampingRatio = dampingRatio;
    fd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
    fd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
    fd.type = org.jbox2d.dynamics.joints.JointType.WHEEL;
    return fd;
}
项目:libgdxcn    文件:PrismaticJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.PrismaticJointDef jd = new org.jbox2d.dynamics.joints.PrismaticJointDef();
    jd.bodyA = bodyA.body;
    jd.bodyB = bodyB.body;
    jd.collideConnected = collideConnected;
    jd.enableLimit = enableLimit;
    jd.enableMotor = enableMotor;
    jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
    jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
    jd.localAxisA.set(localAxisA.x, localAxisA.y);
    jd.lowerTranslation = lowerTranslation;
    jd.maxMotorForce = maxMotorForce;
    jd.motorSpeed = motorSpeed;
    jd.referenceAngle = referenceAngle;
    jd.type = org.jbox2d.dynamics.joints.JointType.PRISMATIC;
    jd.upperTranslation = upperTranslation;
    return jd;
}
项目:libgdxcn    文件:PulleyJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.PulleyJointDef jd = new org.jbox2d.dynamics.joints.PulleyJointDef();
    jd.bodyA = bodyA.body;
    jd.bodyB = bodyB.body;
    jd.collideConnected = collideConnected;
    jd.groundAnchorA.set(groundAnchorA.x, groundAnchorB.y);
    jd.groundAnchorB.set(groundAnchorB.x, groundAnchorB.y);
    jd.lengthA = lengthA;
    jd.lengthB = lengthB;
    jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
    jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
    jd.ratio = ratio;
    jd.type = org.jbox2d.dynamics.joints.JointType.PULLEY;
    return jd;
}
项目:libgdxcn    文件:RevoluteJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.RevoluteJointDef jd = new org.jbox2d.dynamics.joints.RevoluteJointDef();
    jd.bodyA = bodyA.body;
    jd.bodyB = bodyB.body;
    jd.collideConnected = collideConnected;
    jd.enableLimit = enableLimit;
    jd.enableMotor = enableMotor;
    jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
    jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
    jd.lowerAngle = lowerAngle;
    jd.maxMotorTorque = maxMotorTorque;
    jd.motorSpeed = motorSpeed;
    jd.referenceAngle = referenceAngle;
    jd.type = org.jbox2d.dynamics.joints.JointType.REVOLUTE;
    jd.upperAngle = upperAngle;
    return jd;
}
项目:flixel-gdx-box2d    文件:B2FlxJoint.java   
/**
 * Depending on the type of joint there is no need of two bodies. You can safely 
 * pass a JointDef and reuse it. If both bodies are not passed, then an error will 
 * be prompt.
 * @param spriteA   The first body.
 * @param spriteB   The second body.
 * @param jointDef  The joint definition.
 */
public B2FlxJoint(B2FlxShape spriteA, B2FlxShape spriteB, JointDef jointDef)
{
    super();

    if(spriteA != null)
    {
        bodyA = spriteA.body;
        spriteA.joints.add(this);
    }
    if(spriteB != null)
    {
        bodyB = spriteB.body;
        spriteB.joints.add(this);
    }
    if(bodyA == null && bodyB == null)
        throw new Error("your jointDef must have b2Body instances for its a and b properties");
    if(jointDef != null)
        this.jointDef = jointDef;

    scrollFactor = new FlxPoint(1.0f,1.0f);

    B2FlxB.flxJoints.add(this);

    init();
}
项目:ZombieCopter    文件:JointModel.java   
public JointDef toJointDef(Body bodyA, Body bodyB){
    logger.debug("Creating joint def");
    JointDef jd = toJointDef(type);
    jd.bodyA = bodyA;
    jd.bodyB = bodyB;
    jd.collideConnected = collideConnected;
    return jd;
}
项目:libgdxcn    文件:GearJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.GearJointDef jd = new org.jbox2d.dynamics.joints.GearJointDef();
    jd.bodyA = bodyA.body;
    jd.bodyB = bodyB.body;
    jd.collideConnected = collideConnected;
    jd.joint1 = joint1.getJBox2DJoint();
    jd.joint2 = joint2.getJBox2DJoint();
    jd.ratio = ratio;
    jd.type = org.jbox2d.dynamics.joints.JointType.GEAR;
    return jd;
}
项目:libgdxcn    文件:RopeJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.RopeJointDef fd = new org.jbox2d.dynamics.joints.RopeJointDef();
    fd.bodyA = bodyA.body;
    fd.bodyB = bodyB.body;
    fd.collideConnected = collideConnected;
    fd.maxLength = maxLength;
    fd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
    fd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
    fd.type = org.jbox2d.dynamics.joints.JointType.ROPE;
    return fd;
}
项目:libgdxcn    文件:MotorJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.MotorJointDef jd = new org.jbox2d.dynamics.joints.MotorJointDef();
    jd.bodyA = bodyA.body;
    jd.bodyB = bodyB.body;
    jd.collideConnected = collideConnected;
    jd.linearOffset.set(linearOffset.x, linearOffset.y);
    jd.angularOffset = angularOffset;
    jd.maxForce = maxForce;
    jd.maxTorque = maxTorque;
    jd.type = org.jbox2d.dynamics.joints.JointType.MOTOR;
    return jd;
}
项目:libgdxcn    文件:FrictionJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.FrictionJointDef jd = new org.jbox2d.dynamics.joints.FrictionJointDef();
    jd.bodyA = bodyA.body;
    jd.bodyB = bodyB.body;
    jd.collideConnected = collideConnected;
    jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
    jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
    jd.maxForce = maxForce;
    jd.maxTorque = maxTorque;
    jd.type = org.jbox2d.dynamics.joints.JointType.FRICTION;
    return jd;
}
项目:libgdxcn    文件:WeldJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.WeldJointDef jd = new org.jbox2d.dynamics.joints.WeldJointDef();
    jd.bodyA = bodyA.body;
    jd.bodyB = bodyB.body;
    jd.collideConnected = collideConnected;
    jd.dampingRatio = dampingRatio;
    jd.frequencyHz = frequencyHz;
    jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
    jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
    jd.referenceAngle = referenceAngle;
    jd.type = org.jbox2d.dynamics.joints.JointType.WELD;
    return jd;
}
项目:libgdxcn    文件:MouseJointDef.java   
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
    org.jbox2d.dynamics.joints.MouseJointDef jd = new org.jbox2d.dynamics.joints.MouseJointDef();
    jd.bodyA = bodyA.body;
    jd.bodyB = bodyB.body;
    jd.collideConnected = collideConnected;
    jd.dampingRatio = dampingRatio;
    jd.frequencyHz = frequencyHz;
    jd.maxForce = maxForce;
    jd.target.set(target.x, target.y);
    jd.type = org.jbox2d.dynamics.joints.JointType.MOUSE;
    return jd;
}
项目:radial    文件:WheelJointConfig.java   
@Override
public JointDef createDef(Body sourceBody, Body targetBody, final Vector2 targetOffset) {
  WheelJointDef jointDef = new WheelJointDef() {{
    enableMotor = true;
    frequencyHz = suspensionFrequencyHz;
    dampingRatio = suspensionDampingRatio;
  }};

  Vector2 worldTarget = new Vector2(targetBody.getWorldCenter()).add(targetOffset);
  jointDef.initialize(sourceBody, targetBody, worldTarget, axisOfMovement);
  return jointDef;
}
项目:radial    文件:PrismaticJointConfig.java   
@Override
public JointDef createDef(Body sourceBody, Body targetBody, final Vector2 targetOffset) {
  PrismaticJointDef jointDef = new PrismaticJointDef() {{
    enableLimit = true;
    enableMotor = true;
    lowerTranslation = PrismaticJointConfig.this.lowerTranslation;
    upperTranslation = PrismaticJointConfig.this.upperTranslation;
  }};

  Vector2 worldTarget = new Vector2(targetBody.getWorldCenter()).add(targetOffset);
  jointDef.initialize(sourceBody, targetBody, worldTarget, axisOfMovement);
  return jointDef;
}
项目: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;
}
项目:tilt-game-android    文件:PhysicsWorld.java   
public Joint createJoint(final JointDef pDef) {
    return this.mWorld.createJoint(pDef);
}
项目:ZombieCopter    文件:JointModel.java   
public JointModel(JointDef jd,String bodyName1, String bodyName2){
    this.fromJointDef(jd,bodyName1,bodyName2);
}
项目:ZombieCopter    文件:JointModel.java   
public JointModel(String theName, JointDef jd,String bodyName1, String bodyName2){
    name = theName;
    this.fromJointDef(jd,bodyName1,bodyName2);
}
项目:ZombieCopter    文件:JointModel.java   
public Joint toJoint(World world,Body bodyA, Body bodyB){
    logger.debug("Creating Joint");
    JointDef jd = this.toJointDef(bodyA,bodyB);
    return world.createJoint(jd);

    /*
    switch (type){

    case DistanceJoint:{
        return world.createJoint((DistanceJointDef)jd);
    }

    case FrictionJoint:{
        return world.createJoint((FrictionJointDef)jd);
    }

    case GearJoint:{
        return world.createJoint((GearJointDef)jd);
    }

    case MotorJoint:{
        return world.createJoint((MotorJointDef)jd);
    }

    case MouseJoint:{
        return world.createJoint((MouseJointDef)jd);
    }

    case PrismaticJoint:{
        return world.createJoint((PrismaticJointDef)jd);
    }

    case PulleyJoint:{
        return world.createJoint((PulleyJointDef)jd);
    }

    case RevoluteJoint:{
        return world.createJoint((RevoluteJointDef)jd);
    }

    case RopeJoint:{
        return world.createJoint((RopeJointDef)jd);
    }

    case WeldJoint:{
        return world.createJoint((WeldJointDef)jd);
    }

    case WheelJoint:{
        return world.createJoint((WheelJointDef)jd);            
    }

    }
    return null;
    */
}
项目:flixel-gdx-box2d    文件:B2FlxWeldJoint.java   
@Override
public B2FlxWeldJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:flixel-gdx-box2d    文件:B2FlxRopeJoint.java   
@Override
public B2FlxRopeJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:flixel-gdx-box2d    文件:B2FlxDistanceJoint.java   
@Override
public B2FlxDistanceJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:flixel-gdx-box2d    文件:B2FlxFrictionJoint.java   
@Override
public B2FlxFrictionJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:flixel-gdx-box2d    文件:B2FlxRevoluteJoint.java   
@Override
public B2FlxRevoluteJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:flixel-gdx-box2d    文件:B2FlxWheelJoint.java   
@Override
public B2FlxWheelJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:flixel-gdx-box2d    文件:B2FlxGearJoint.java   
@Override
public B2FlxGearJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:flixel-gdx-box2d    文件:B2FlxPrismaticJoint.java   
@Override
public B2FlxPrismaticJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:flixel-gdx-box2d    文件:B2FlxJoint.java   
/**
 * Set the joint definition.
 * @param jointDef
 * @return  This joint. Handy for chaining stuff together.
 */
public B2FlxJoint setJointDef(JointDef jointDef)
{
    this.jointDef = jointDef;
    return this;
}
项目:flixel-gdx-box2d    文件:B2FlxPulleyJoint.java   
@Override
public B2FlxPulleyJoint setJointDef(JointDef jointDef){super.setJointDef(jointDef);return this;}
项目:NationSoccer    文件:PhysicsWorld.java   
public Joint createJoint(final JointDef pDef) {
    return this.mWorld.createJoint(pDef);
}
项目:ingress-indonesia-dev    文件:GearJointDef.java   
public GearJointDef()
{
  this.type = JointDef.JointType.GearJoint;
}
项目:ingress-indonesia-dev    文件:RopeJointDef.java   
public RopeJointDef()
{
  this.type = JointDef.JointType.RopeJoint;
}
项目:ingress-indonesia-dev    文件:WheelJointDef.java   
public WheelJointDef()
{
  this.type = JointDef.JointType.WheelJoint;
}
项目:ingress-indonesia-dev    文件:FrictionJointDef.java   
public FrictionJointDef()
{
  this.type = JointDef.JointType.FrictionJoint;
}
项目:ingress-indonesia-dev    文件:PrismaticJointDef.java   
public PrismaticJointDef()
{
  this.type = JointDef.JointType.PrismaticJoint;
}
项目:ingress-indonesia-dev    文件:DistanceJointDef.java   
public DistanceJointDef()
{
  this.type = JointDef.JointType.DistanceJoint;
}
项目:ingress-indonesia-dev    文件:WeldJointDef.java   
public WeldJointDef()
{
  this.type = JointDef.JointType.WeldJoint;
}
项目:ingress-indonesia-dev    文件:MouseJointDef.java   
public MouseJointDef()
{
  this.type = JointDef.JointType.MouseJoint;
}
项目:ingress-indonesia-dev    文件:PulleyJointDef.java   
public PulleyJointDef()
{
  this.type = JointDef.JointType.PulleyJoint;
  this.collideConnected = true;
}
项目:ingress-indonesia-dev    文件:RevoluteJointDef.java   
public RevoluteJointDef()
{
  this.type = JointDef.JointType.RevoluteJoint;
}