当前位置: 首页>>代码示例>>Java>>正文


Java JointType类代码示例

本文整理汇总了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);
  }
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:37,代码来源:DwJoint.java

示例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);
        }
      }
      
    }

  }
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:39,代码来源:DwWorld.java

示例3: WeldJointDef

import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
public WeldJointDef() {
  super(JointType.WELD);
  localAnchorA = new Vec2();
  localAnchorB = new Vec2();
  referenceAngle = 0.0f;
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:7,代码来源:WeldJointDef.java

示例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);
  }
}
 
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:44,代码来源:DwDebugDraw.java

示例5: WeldJointDef

import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
public WeldJointDef(){
	type = JointType.WELD;
	localAnchorA = new Vec2();
	localAnchorB = new Vec2();
	referenceAngle = 0.0f;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:7,代码来源:WeldJointDef.java

示例6: isIndependentJoint

import org.jbox2d.dynamics.joints.JointType; //导入依赖的package包/类
public static boolean isIndependentJoint(JointType argType){
	return argType != JointType.GEAR && argType != JointType.CONSTANT_VOLUME;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:SerializationHelper.java


注:本文中的org.jbox2d.dynamics.joints.JointType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。