This is a script I created to use as a default camera control, because I find the built in camera control really awkward.
The script creates a blank NodePath to use as an anchor and reparents the camera to it. The script has 3 inputs to control the camera. They are:
The left mouse button causes the anchor to move forward, taking the camera with it.
Holding the right mouse button and moving the mouse causes the anchor to rotate left, right, up, and down, which makes the camera orbit around the anchor’s location.
Holding the middle mouse button and moving the mouse up or down causes the camera to move closer to, or away from, the anchor.
There are 4 variables to help adjust the controls to meet the needs of a given usage. Distances are all in panda units. The variables are:
self.initZoom - the distance from the anchor that the camera will start at.
self.zoomInLimit - the minimum distance the camera can be from the anchor. If this value is negative, the camera can move past the anchor when zooming.
self.zoomOutLimit - the maximum distance the camera can be from the anchor.
self.moveSpeed - the number of units the anchor will move, per frame, when the left mouse button is held.
To use this camera controller, just import and instantiate the class.