Currently in my three.js program, pressing the "w" key moves the camera forward. The code snippet responsible for this action is as follows:
if (keys.indexOf(playerControls["forward"]) != -1) {
camera.translateZ(-0.1);
}
I am now looking to modify the behavior so that when "w" is pressed, the camera moves only horizontally (along the x and z axes) without vertical movement (y-axis). Can anyone provide a solution that achieves this requirement, preferably avoiding complex trigonometric calculations?