【发布时间】:2014-10-24 02:59:58
【问题描述】:
我正在尝试创建一个可以做很多事情的 InputProcessor。我设置了一个触摸板,我试图沿 x 和 y 轴移动相机。
tBounds = new Sprite(Assets.touchpadBounds);
tBounds.setSize(tBounds.getWidth() * scale, tBounds.getHeight() * scale);
tKnob = new Sprite(Assets.touchpad);
tKnob.setSize(tKnob.getWidth() * scale, tKnob.getHeight() * scale);
touchpad = new Skin();
touchpad.add("boundary", tBounds);
touchpad.add("circle", tKnob);
touchpadStyle = new TouchpadStyle();
bounds = touchpad.getDrawable("boundary");
knob = touchpad.getDrawable("circle");
touchpadStyle.background = bounds;
touchpadStyle.knob = knob;
pad = new Touchpad(10, touchpadStyle);
stage.addActor(pad);
//Setting Bounds
pad.setBounds(width / 14, height / 10, tBounds.getHeight(),
tBounds.getWidth());
private void setKnobAction() {
camera.position.set(camera.position.x + (pad.getKnobPercentX() * 0.1f),
camera.position.y + 0,
camera.position.z - (pad.getKnobPercentY() * 0.1f));
camera.update();
}
我在使用 setKnobAction() 时遇到的问题是它会根据它所面对的初始方向移动相机。我希望它朝着当前所面对的方向移动。
【问题讨论】: