1
我正在使用MouseJoint拖动对象。但是物体的移动太慢了。LibGDX - Box2D:使用MouseJoint移动没有速度限制的对象
我需要将它们与鼠标的速度移动。目前,我用MouseJointDef
这些设置:
MouseJointDef def = new MouseJointDef();
def.bodyA = groundBody;
def.bodyB = hitBody;
def.collideConnected = true;
def.target.set(testPoint.x, testPoint.y);
def.maxForce = 10000.0f * hitBody.getMass();
def.frequencyHz=100;
def.dampingRatio=0;
这些一个身体:
Body box = world.createBody(def);
MassData mass = new MassData();
mass.mass=100;
//mass.I=1; What is it???
mass.center.set(width/2, height/2);
box.setMassData(mass);
我该怎么办?
我的错误是我用'this.cam.setToOrtho(false,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());'在用正确的参数创建相机实例之后! :) 谢谢 – Nolesh