本文整理汇总了Java中org.jbox2d.dynamics.joints.MouseJointDef类的典型用法代码示例。如果您正苦于以下问题:Java MouseJointDef类的具体用法?Java MouseJointDef怎么用?Java MouseJointDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MouseJointDef类属于org.jbox2d.dynamics.joints包,在下文中一共展示了MouseJointDef类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: BlockSpring
import org.jbox2d.dynamics.joints.MouseJointDef; //导入依赖的package包/类
public BlockSpring(PeaWorld peaWorld, World world, float x, float y, float angle) {
super(peaWorld, peaWorld.getEntityImage("Block-Spring.png"), x, y, angle);
// add the spring joint
MouseJointDef mjd = new MouseJointDef();
mjd.bodyA = world.getBodyList();
body = initPhysicsBody(world, x, y, angle);
mjd.bodyB = getBody();
mjd.target.set(new Vec2(x, y));
mjd.maxForce = 40f * getBody().getMass();
mjd.dampingRatio = 0.2f;
mj = (MouseJoint) world.createJoint(mjd);
setPos(x, y);
setAngle(angle);
}
开发者ID:playn,项目名称:playn-samples,代码行数:17,代码来源:BlockSpring.java
示例2: BlockSpring
import org.jbox2d.dynamics.joints.MouseJointDef; //导入依赖的package包/类
public BlockSpring(PeaWorld peaWorld, World world, float x, float y, float angle) {
super(peaWorld, x, y, angle);
// add the spring joint
MouseJointDef mjd = new MouseJointDef();
mjd.bodyA = world.getBodyList();
body = initPhysicsBody(world, x, y, angle);
mjd.bodyB = getBody();
mjd.target.set(new Vec2(x, y));
mjd.maxForce = 40f * getBody().getMass();
mjd.dampingRatio = 0.2f;
mj = (MouseJoint) world.createJoint(mjd);
setPos(x, y);
setAngle(angle);
}
开发者ID:fredsa,项目名称:forplay,代码行数:17,代码来源:BlockSpring.java
示例3: press
import org.jbox2d.dynamics.joints.MouseJointDef; //导入依赖的package包/类
public void press(float screen_x, float screen_y) {
if (query(screen_x, screen_y)) {
Body body = fixture.getBody();
MouseJointDef def = new MouseJointDef();
def.bodyA = world.createBody(new BodyDef());
def.bodyB = fixture.getBody();
def.collideConnected = true;
def.target.set(point);
def.maxForce = mult_dragforce * body.getMass();
mouse_joint = (MouseJoint) world.createJoint(def);
body.setAwake(true);
}
active = (mouse_joint != null);
}
开发者ID:diwi,项目名称:LiquidFunProcessing,代码行数:15,代码来源:DwMouseDragBodies.java
示例4: controlPointCreated
import org.jbox2d.dynamics.joints.MouseJointDef; //导入依赖的package包/类
public void controlPointCreated(ControlPoint cp) {
PVector local = transformToLocalSpace(new PVector(cp.getX(), cp.getY()));
Vec2 pos = getBody().getWorldPoint(new Vec2(local.x, local.y));
MouseJointDef mouseJointDef = new MouseJointDef();
mouseJointDef.body1 = getWorld().getGroundBody();
mouseJointDef.body2 = getBody();
mouseJointDef.target.set(pos);
mouseJointDef.maxForce = 100000.0f * getBody().m_mass;
joints.put(cp, (MouseJoint) getWorld().createJoint(mouseJointDef));
getBody().wakeUp();
}
开发者ID:nuigroup,项目名称:hci-for-java,代码行数:12,代码来源:PhysicsComponent.java
注:本文中的org.jbox2d.dynamics.joints.MouseJointDef类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论