本文整理汇总了Java中com.badlogic.gdx.physics.box2d.JointDef.JointType.PulleyJoint方法的典型用法代码示例。如果您正苦于以下问题:Java JointType.PulleyJoint方法的具体用法?Java JointType.PulleyJoint怎么用?Java JointType.PulleyJoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.physics.box2d.JointDef.JointType
的用法示例。
在下文中一共展示了JointType.PulleyJoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getType
import com.badlogic.gdx.physics.box2d.JointDef.JointType; //导入方法依赖的package包/类
/** Get the type of the concrete joint. */
public JointType getType () {
org.jbox2d.dynamics.joints.JointType type2 = joint.getType();
if (type2 == org.jbox2d.dynamics.joints.JointType.DISTANCE) return JointType.DistanceJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.FRICTION) return JointType.FrictionJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.GEAR) return JointType.GearJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.MOUSE) return JointType.MouseJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.PRISMATIC) return JointType.PrismaticJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.PULLEY) return JointType.PulleyJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.REVOLUTE) return JointType.RevoluteJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.ROPE) return JointType.RopeJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.UNKNOWN) return JointType.Unknown;
if (type2 == org.jbox2d.dynamics.joints.JointType.WELD) return JointType.WeldJoint;
if (type2 == org.jbox2d.dynamics.joints.JointType.WHEEL) return JointType.WheelJoint;
return JointType.Unknown;
}
示例2: drawJoint
import com.badlogic.gdx.physics.box2d.JointDef.JointType; //导入方法依赖的package包/类
private void drawJoint (Joint joint) {
Body bodyA = joint.getBodyA();
Body bodyB = joint.getBodyB();
Transform xf1 = bodyA.getTransform();
Transform xf2 = bodyB.getTransform();
Vector2 x1 = xf1.getPosition();
Vector2 x2 = xf2.getPosition();
Vector2 p1 = joint.getAnchorA();
Vector2 p2 = joint.getAnchorB();
if (joint.getType() == JointType.DistanceJoint) {
drawSegment(p1, p2, JOINT_COLOR);
} else if (joint.getType() == JointType.PulleyJoint) {
PulleyJoint pulley = (PulleyJoint)joint;
Vector2 s1 = pulley.getGroundAnchorA();
Vector2 s2 = pulley.getGroundAnchorB();
drawSegment(s1, p1, JOINT_COLOR);
drawSegment(s2, p2, JOINT_COLOR);
drawSegment(s1, s2, JOINT_COLOR);
} else if (joint.getType() == JointType.MouseJoint) {
drawSegment(joint.getAnchorA(), joint.getAnchorB(), JOINT_COLOR);
} else {
drawSegment(x1, p1, JOINT_COLOR);
drawSegment(p1, p2, JOINT_COLOR);
drawSegment(x2, p2, JOINT_COLOR);
}
}