let currCamera;
function
setup() {
createCanvas(500, 500, WEBGL);
helpText = createP(
"Move the sliders to change the "
+
"position where the camera is looking"
);
helpText2 = createP(
"The sphere shows the point where "
+
"the camera is currently looking"
);
helpText.position(20, 0);
helpText2.position(20, 110);
currCamera = createCamera();
xPosSlider = createSlider(-360, 360, 0);
xPosSlider.position(20, 60);
yPosSlider = createSlider(-360, 360, 0);
yPosSlider.position(20, 80);
zPosSlider = createSlider(-360, 360, 100);
zPosSlider.position(20, 100);
}
function
draw() {
clear();
lights();
normalMaterial();
debugMode();
let currX = xPosSlider.value();
let currY = yPosSlider.value();
let currZ = zPosSlider.value();
currCamera.lookAt(currX, currY, currZ);
translate(currX, currY, currZ);
sphere(5);
translate(-currX, -currY, -currZ);
rotateX(50);
rotateY(50);
box(90);
}