class Camera { float camX, camY, camZ; float x, y, z; float radius; float theta, phi; Camera(float r) { radius = r; phi = 90; theta = 135; x = 0; y = 0; z = 0; } void Update(float deltaX, float deltaY) { phi += deltaX; theta += deltaY; theta = constrain(theta, 1, 179); x = radius * cos(radians(phi)) * sin(radians(theta)); y = radius * cos(radians(theta)); z = radius * sin(radians(theta)) * sin(radians(phi)); camX = x; camY = y; camZ = z; camera(camX, camY, camZ, 0, 0, 0, 0, 1, 0); } void Zoom(float f) { radius = constrain(radius + f, 10, 200); } }