/** Set/get damping ratio. */ public float getDampingRatio () { return joint.getDampingRatio(); } }
/** Set/get frequency in Hz. */ public float getFrequency () { return joint.getFrequency(); }
/** Set/get the natural length. Manipulating the length can lead to non-physical behavior when the frequency is zero. */ public float getLength () { return joint.getLength(); }
DistanceJoint j = (DistanceJoint) joint; builder.setType(PbJointType.DISTANCE); builder.setLocalAnchorA(vecToPb(j.getLocalAnchorA())); builder.setLocalAnchorB(vecToPb(j.getLocalAnchorB())); builder.setLength(j.getLength()); builder.setFrequency(j.getFrequency()); builder.setDampingRatio(j.getDampingRatio()); break;
return new MouseJoint(world.getPool(), (MouseJointDef) def); case DISTANCE: return new DistanceJoint(world.getPool(), (DistanceJointDef) def); case PRISMATIC: return new PrismaticJoint(world.getPool(), (PrismaticJointDef) def);
public Vector2 getLocalAnchorA () { Vec2 localAnchor = joint.getLocalAnchorA(); localAnchorA.set(localAnchor.x, localAnchor.y); return localAnchorA; }
public Vector2 getLocalAnchorB () { Vec2 localAnchor = joint.getLocalAnchorB(); localAnchorB.set(localAnchor.x, localAnchor.y); return localAnchorB; }
/** Set/get damping ratio. */ public void setDampingRatio (float ratio) { joint.setDampingRatio(ratio); }
return new MouseJoint(world.getPool(), (MouseJointDef) def); case DISTANCE: return new DistanceJoint(world.getPool(), (DistanceJointDef) def); case PRISMATIC: return new PrismaticJoint(world.getPool(), (PrismaticJointDef) def);
return new MouseJoint(world.getPool(), (MouseJointDef) def); case DISTANCE: return new DistanceJoint(world.getPool(), (DistanceJointDef) def); case PRISMATIC: return new PrismaticJoint(world.getPool(), (PrismaticJointDef) def);
public static Joint create(World world, JointDef def) { // Joint joint = null; switch (def.type) { case MOUSE: return new MouseJoint(world.getPool(), (MouseJointDef) def); case DISTANCE: return new DistanceJoint(world.getPool(), (DistanceJointDef) def); case PRISMATIC: return new PrismaticJoint(world.getPool(), (PrismaticJointDef) def); case REVOLUTE: return new RevoluteJoint(world.getPool(), (RevoluteJointDef) def); case WELD: return new WeldJoint(world.getPool(), (WeldJointDef) def); case FRICTION: return new FrictionJoint(world.getPool(), (FrictionJointDef) def); case WHEEL: return new WheelJoint(world.getPool(), (WheelJointDef) def); case GEAR: return new GearJoint(world.getPool(), (GearJointDef) def); case PULLEY: return new PulleyJoint(world.getPool(), (PulleyJointDef) def); case CONSTANT_VOLUME: return new ConstantVolumeJoint(world, (ConstantVolumeJointDef) def); case ROPE: return new RopeJoint(world.getPool(), (RopeJointDef) def); case UNKNOWN: default: return null; } }
return new MouseJoint(world.getPool(), (MouseJointDef) def); case DISTANCE: return new DistanceJoint(world.getPool(), (DistanceJointDef) def); case PRISMATIC: return new PrismaticJoint(world.getPool(), (PrismaticJointDef) def);