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