use of spacegraph.space2d.phys.dynamics.joints.DistanceJoint in project narchy by automenta.
the class Box2DTests method drawJoint.
private void drawJoint(Joint joint) {
g.setColor(Color.GREEN);
Tuple2f v1 = new Vec2();
Tuple2f v2 = new Vec2();
switch(joint.getType()) {
case DISTANCE:
DistanceJoint dj = (DistanceJoint) joint;
v1 = joint.getBodyA().getWorldPoint(dj.getLocalAnchorA());
v2 = joint.getBodyB().getWorldPoint(dj.getLocalAnchorB());
break;
case MOUSE:
MouseJoint localMj = (MouseJoint) joint;
localMj.getAnchorA(v1);
localMj.getAnchorB(v2);
break;
}
Point p1 = getPoint(v1);
Point p2 = getPoint(v2);
g.drawLine(p1.x, p1.y, p2.x, p2.y);
}
Aggregations