Camera - what to use?

I noticed using base.cam yields different results from using camera.

Which one should I use?

As described in the manual at http://www.panda3d.org/manual/index.php/Camera_Control, the camera be be controlled using either one, but it is preferable to use base.camera (or simply camera, which is a global alias).

print base.cam                # render/camera/cam
print base.camera             # render/camera
print camera                  # render/camera
print base.camera is camera   # True

In general, use base.camera for manipulation of the camera node in the scene. It represents the so-called “camera group”, which other cameras may be reparented to in some esoteric situations. It is just a dummy, whereas base.cam is the actual camera node.

Then there’s base.camNode, which equals base.cam.node(), and there’s base.camLens, which equals base.cam.node().getLens().

I don’t advise using just “camera” without “base” at all. It’s an old and deprecated variable that will probably be removed at some point.