本文整理汇总了Java中org.jbox2d.dynamics.joints.JointType类的典型用法代码示例。如果您正苦于以下问题:Java JointType类的具体用法?Java JointType怎么用?Java JointType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JointType类属于org.jbox2d.dynamics.joints包,在下文中一共展示了JointType类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DwJoint
import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
public DwJoint(DwBodyGroup parent, Joint joint){
this.parent = parent;
this.joint = joint;
JointType type = joint.getType();
// create PShape
// this.shape = parent.papplet.createShape(PConstants.LINE, 0, 0, 1, 0);
// this.shape.setStrokeJoin(PConstants.ROUND);
// this.shape.setStrokeCap(PConstants.ROUND);
// shape = parent.papplet.createShape();
// shape.beginShape(PConstants.QUADS);
// shape.fill(255);
// shape.vertex(0,0);
// shape.vertex(1,0);
// shape.vertex(1,1);
// shape.vertex(0,1);
// shape.endShape();
if(type == JointType.PULLEY){
shape = parent.papplet.createShape(PConstants.GROUP);
shape.addChild(parent.papplet.createShape(PConstants.LINE, 0, 0, 1, 0));
shape.addChild(parent.papplet.createShape(PConstants.LINE, 0, 0, 1, 0));
shape.addChild(parent.papplet.createShape(PConstants.LINE, 0, 0, 1, 0));
} else {
shape = parent.papplet.createShape(PConstants.LINE, 0, 0, 1, 0);
}
// link PShapes
parent.shape.addChild(shape);
joint.setUserData(this);
}
示例2: updateJoints
import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
public void updateJoints(){
Vec2 ancA = new Vec2();
Vec2 ancB = new Vec2();
for (Joint joint = super.getJointList(); joint != null; joint = joint.getNext()) {
DwJoint dwjoint = getShape(joint);
if(dwjoint != null){
PShape shape = dwjoint.shape;
JointType type = joint.getType();
joint.getAnchorA(ancA);
joint.getAnchorB(ancB);
// Body bodyA = joint.getBodyA();
// Body bodyB = joint.getBodyB();
// Transform xfA = bodyA.getTransform();
// Transform xfB = bodyB.getTransform();
// Vec2 posA = xfA.p;
// Vec2 posB = xfB.p;
if(type == JointType.PULLEY){
PulleyJoint pulley = (PulleyJoint) joint;
Vec2 gancA = pulley.getGroundAnchorA();
Vec2 gancB = pulley.getGroundAnchorB();
updateLineShape(shape.getChild(0), ancA, gancA);
updateLineShape(shape.getChild(1), ancB, gancB);
updateLineShape(shape.getChild(2), gancA, gancB);
} else {
updateLineShape(shape, ancA, ancB);
}
}
}
}
示例3: WeldJointDef
import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
public WeldJointDef() {
super(JointType.WELD);
localAnchorA = new Vec2();
localAnchorB = new Vec2();
referenceAngle = 0.0f;
}
示例4: display
import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
static public void display(PGraphics pg, Joint joint){
Body bodyA = joint.getBodyA();
Body bodyB = joint.getBodyB();
Transform xfA = bodyA.getTransform();
Transform xfB = bodyB.getTransform();
Vec2 posA = xfA.p;
Vec2 posB = xfB.p;
Vec2 ancA = new Vec2();
Vec2 ancB = new Vec2();
joint.getAnchorA(ancA);
joint.getAnchorB(ancB);
JointType type = joint.getType();
switch (type) {
case DISTANCE:
line(pg, ancA, ancB);
break;
case PULLEY:
PulleyJoint pulley = (PulleyJoint) joint;
Vec2 gancA = pulley.getGroundAnchorA();
Vec2 gancB = pulley.getGroundAnchorB();
line(pg, gancA, ancA);
line(pg, gancB, ancB);
line(pg, gancA, gancB);
break;
case CONSTANT_VOLUME:
line(pg, ancA, ancB);
break;
case MOUSE:
line(pg, ancA, ancB);
break;
default:
line(pg, posA, ancA);
line(pg, ancA, ancB);
line(pg, posB, ancB);
}
}
示例5: WeldJointDef
import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
public WeldJointDef(){
type = JointType.WELD;
localAnchorA = new Vec2();
localAnchorB = new Vec2();
referenceAngle = 0.0f;
}
示例6: isIndependentJoint
import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
public static boolean isIndependentJoint(JointType argType){
return argType != JointType.GEAR && argType != JointType.CONSTANT_VOLUME;
}