public Vector2 getGroundAnchorA () { Vec2 g = joint.getGroundAnchorA(); return groundAnchorA.set(g.x, g.y); }
public Vector2 getGroundAnchorB () { Vec2 g = joint.getGroundAnchorB(); return groundAnchorB.set(g.x, g.y); }
/** Get the pulley ratio. */ public float getRatio () { return joint.getRatio(); } }
Vec2 s1 = pulley.getGroundAnchorA(); Vec2 s2 = pulley.getGroundAnchorB(); m_debugDraw.drawSegment(s1, p1, color); m_debugDraw.drawSegment(s2, p2, color);
PulleyJoint j = (PulleyJoint) joint; builder.setType(PbJointType.PULLEY); builder.setLocalAnchorA(vecToPb(j.getLocalAnchorA())); builder.setLocalAnchorB(vecToPb(j.getLocalAnchorB())); builder.setGroundAnchorA(vecToPb(j.getGroundAnchorA())); builder.setGroundAnchorB(vecToPb(j.getGroundAnchorB())); builder.setLengthA(j.getLengthA()); builder.setLengthB(j.getLengthB()); builder.setRatio(j.getRatio()); break;
@Override public void step(TestbedSettings settings) { super.step(settings); float ratio = m_joint1.getRatio(); float L = m_joint1.getLength1() + ratio * m_joint1.getLength2(); addTextLine("L1 + " + ratio + " * L2 = " + L); if (L >= 36) { addTextLine("Pulley is taught"); } }
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);
/** Get the current length of the segment attached to body1. */ public float getLength1 () { return joint.getLength1(); }
/** Get the current length of the segment attached to body2. */ public float getLength2 () { return joint.getLength2(); }
Vec2 s1 = pulley.getGroundAnchorA(); Vec2 s2 = pulley.getGroundAnchorB(); m_debugDraw.drawSegment(s1, p1, color); m_debugDraw.drawSegment(s2, p2, color);
@Override public void step(TestbedSettings settings) { super.step(settings); float ratio = m_joint1.getRatio(); float L = m_joint1.getLength1() + ratio * m_joint1.getLength2(); addTextLine("L1 + " + ratio + " * L2 = " + L); if (L >= 36) { addTextLine("Pulley is taught"); } }
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);
Vec2 s1 = pulley.getGroundAnchorA(); Vec2 s2 = pulley.getGroundAnchorB(); m_debugDraw.drawSegment(s1, p1, color); m_debugDraw.drawSegment(s2, p2, color);
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);
Vec2 s1 = pulley.getGroundAnchorA(); Vec2 s2 = pulley.getGroundAnchorB(); m_debugDraw.drawSegment(s1, p1, color); m_debugDraw.drawSegment(s2, p2, color);
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; } }
Vec2 s1 = pulley.getGroundAnchorA(); Vec2 s2 = pulley.getGroundAnchorB(); debugDraw.drawSegment(s1, p1, color); debugDraw.drawSegment(s2, p2, color);
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);