Module 4: Camera Manipulations and Multiple Views
Basic Camera Controls
Run Behavior
Text Only N: Move camera by (x, y) values (from X/Y slider bars)
M: Move camera to (x, y) values (to Dye's location)
H: Zoom with respect to center (zoom factor slider)
J: Zoom with respect to Dye (zoom factor slider)
Scene Setup
Text Only MainCamera:
- Has CameraSupport
UI-Canvas:
- X/Y/Zoom sliders (connected to UserControlLogic)
TheWorld:
- Has UserControlLogic
- Background: Z=1 (larger than hero and egg)
- Hero and Egg components
Core Components
UserControlLogic
- Central object for receiving/parsing user input
- Connects to UI sliders and game objects
- Transmits input to cause changes
Camera Support
- CameraSupport: includes ClampToWorldBound()
- CameraSupport_Manipulate: handles camera operations
- MoveBy
- MoveTo
- Zoom (towards center)
- ZoomTowards (point)
- PushCameraByPos()
Lerp Implementation
Run Behavior
Text Only Z: Trigger Lerp effect
- Increases to double size
- Gradually lerps back
- Can compound if triggered repeatedly
TimedLerp Class
Text Only - Performs lerp over fixed duration
- Rate measured in seconds
- Rate and Duration controlled via UI sliders
HeroControl Integration
Text Only - BeginLerp() initiates lerp
- LerpIsActive() monitors lerp status
- SetLerpParms() optional for known values
Camera Manipulation
Enhanced Features
Text Only - Position Lerp
- Size Lerp
- Automatic Update() checking
- Damping effects on movement
Shake Implementation
Text Only - X key triggers camera shake
- Uses DampedHarmonic function
- Configurable cycles and duration
- Returns to original position after shake
Viewport and Hero Cam
Small Camera Setup
Text Only - Projection: Orthographic
- Depth: > 0 (Main Camera at -1)
- Configurable viewport settings
CameraSupport Functions
Text Only - SetViewportMinPos(x, y)
- SetViewportSize(w, h)
- Viewport manipulation controls
Scene Management
Scene Transition
Text Only - L key loads new scene
- Maintains lerp and shake information
- Uses UnityEngine.SceneManagement
Persistence
Text Only - GameState class implements Singleton Pattern
- DontDestroyOnLoad() functionality
- Level-specific organization in folders
Project Organization
Text Only - Level-Specific folders
- Utility folder for camera components
- Separated level behaviors
- Centralized game management