
The CameraController script provides comprehensive camera movement, rotation, and zoom functionality for a Unity project in both 2D and 3D environments.This script controls the camera in a Unity scene, enabling users to move, rotate, and zoom using customizable key bindings. It offers the flexibility to:Pan the camera using keyboard inputs or screen edge panning with mouse control.Rotate the camera around a defined pivot point or around its own position.Zoom in and out with assigned key controls.Limit camera movement within a defined boundary range for each axis (X, Y, Z).Provides an optional pivot for rotating around specific points in 3D space.Movement Modes: Supports movement via keyboard keys (W, A, S, D) and mouse edge panning (customizable border thickness).Rotation: Handles free or pivot-based rotation, customizable via key inputs (Q, E, R, F for different axes).Zooming: Zooms in and out based on key inputs (Z, X) and limits zoom range by Y-position.Speed Controls: Includes configurable movement speed, rotation speed, and zoom speed.Boundary Clamping: Ensures the camera stays within set movement boundaries defined by minX, maxX, minY, and maxY.Pivot Point: Optionally supports rotation around a specified pivotPoint transform, otherwise rotates around its own position.Key Bindings: Each action (movement, rotation, zoom) can be independently enabled or disabled and configured with specific keys, including custom controls for vertical movement in 2D games.Collision-Free Movement: The script does not handle collisions but can be adapted to prevent the camera from passing through objects by adding collision detection code.Key Fields:canKeyPan, canMousePan, canRotate, canZoom: Toggles for enabling/disabling movement, rotation, and zoom functionalities.moveForward, moveBackward, etc.: Key bindings for camera movement and actions.panSpeed, rotationSpeed: Control the speed of the camera's movement and rotation.minX, maxX, minY, maxY, minZ, maxZ: Boundaries to constrain the camera's position.pivotPoint: Optional point around which the camera can rotate.This script provides versatile camera control mechanics that are essential for many Unity-based projects, offering both flexibility and ease of integration into various game types.