# Correctness or otherwise of the procedure for generating an orbiting camera in WebGl

I have to create a orbiting camera. I created the model of sun (a sphere) around (0,0,0) , triangulated and Phong shaded it. I would have a camera that goes around the sun thus an orbiting camera and I would know if my way to proceed is right or not: In WebGl there isn't a phisical camera. Nevertheless I imagine to place my camera at the center (0,0,0) and I have first to translate it of [0 0 100] ([0 0 100] is the point where early is located the camera) and later I rotate the camera around y ([0 1 0]) of some angle (Actually the angle is animated, i.e. the angle increases over time).

Thus cameraMatrix = R(angle,[0 1 0])T([0 0 100]) (First translation and later rotation)

But in WebGl there isn't camera, then I have to move the world with inverse transformation namely:

ModelViewMatrix = inverse(cameraMatrix);

Thus ModelViewMatrix = inverse{R(angle,[0 1 0])T([0 0 100])} = inverse(T([0 0 100]))inverse(R(angle,[0 1 0])= T([0 0 -100]) R(-angle,[0 1 0])

(In the last first rotation and later translation)

So far is it all right? Finally in drawScene namely the function of rendering cycle the order of call is inverted namely:

mat4.translate(mvMatrix , [0,0,-100.0]);