base.cam vs base.camera

In the manual (panda3d.org/manual/index.php/Camera_Control) it says

I have a very simple scene in which I wanted to set the initial camera position.
I tried

base.camera.setPos(self.scene, dx, dy, dz)

, but that didn’t work.
Thus, I tried

base.cam.setPos(self.scene, dx, dy, dz)

, which did work. However, I don’t know why.

What is the difference between base.cam and base.camera and why do I need to setPos on base.cam?

Perhaps you did not call base.disableMouse(), which disables the default mouse control. The default mouse controls take control over base.camera.

As the manual page states, base.cam is a NodePath pointing to the actual Camera node, whereas base.camera == base.cam.getParent().

base.camera is actually a special ModelNode that prevents the camera from being flattened together with the rest of the scene when you do something like render.flattenStrong(). It also can act as a grouping when you have a scene with multiple cameras that need to be positioned together.

2 Likes