我在libgdx中有一个多维数据集模型,试图用作第一人称玩家。我正在尝试用相机移动立方体,并努力做到这一点。当我移动相机时,相机将向后退,并且模型将保持原样。
if (Gdx.input.isKeyPressed(Input.Keys.S)) {
Vector3 v = camera.direction.cpy();
v.y = 0f;
v.x = -v.x;
v.z = -v.z;
v.x *= 1;
v.z *= 1;
Matrix4 ghost = new Matrix4();
Vector3 translation = new Vector3();
characterComponent.ghostObject.getWorldTransform(ghost);
ghost.getTranslation(v);
modelComponent.instance.transform.set(v.x, v.y, v.z, camera.direction.x, camera.direction.y, camera.direction.z, 0);
camera.position.set(v.x, v.y, v.z);
camera.update(true);
}