I'm relatively new to three.js and I'm eager to create a scenario where a cube or object moves on a flat surface or road. I have managed to move the object in the z direction, but now I want to move the camera as well, giving the impression of a driver in a car.
function move() {
// Move the cube and camera
cube.position.z -= 0.06;
camera.position.z -= 0.06;
}
However, when I run the code, the movement starts correctly but suddenly the world seems to rotate and change direction. Ideally, I want the cube to move with the camera following behind, resembling a car moving on a road. Instead of the world rotating around the x-axis, I want to maintain a consistent movement. I'm unsure why this rotation is occurring.