I am experimenting with threeJS, and I've got a camera positioned and looking at the origin point of a scene (0,0,0). I want to move that camera around in a circle around the y axis at a set distance (radius), while maintaining its focus on the origin, but I'm not sure how to set up the equation. Currently, I'm just rotating the object itself, but I'd like to be rotating the camera instead. Here's my code to move the mesh:
function checkRotation(){
if (keyboard.pressed("left")){
mesh.rotation.y += .05;
}
if (keyboard.pressed("right")){
mesh.rotation.y -= .05;
}
}
and here would be some sort of example of moving the camera:
camera.position.x = ??? (some equation to move its x position) camera.position.z = ??? (some equation to move its z position) camera.lookAt(mesh.position);
Any help you can provide would be great. Thanks!