需求:角色前后移动时摄像机跟随;左右移动时不跟随。
update(deltaTime: number) {
if (this.radian != 0) {
let move = new Vec3(Math.cos(this.radian) * this.speed.x, 0, -Math.sin(this.radian) * this.speed.z);
this.node.translate(move, 1);
let move2 = new Vec3(0, 0, move.z);
this.camera.translate(move2, 1);
}
}
这个移动摄像机的视角会变化,观察旋转没变。为什么位置增量不一样呢?