Player Movement, Camera & Controls
How the local player moves, dodges, and sees the world. Movement is Rigidbody-driven and networked; the camera is a client-only WoW/Smite-style orbit rig; and the multi-zone world adds one hard rule โ exactly one live camera, always.
PlayerMovement.cs and CameraFollow.cs sit in Assets/Game/Characters/Engineer/Scripts/ โ a relic of when class 0 was called Engineer (โ Warden โ Marauder). They are the shared player movement/camera used by every hero, not Engineer-only code. The folder name is history, not scope. See Canonical Facts & Doc Divergences.
Movement โ PlayerMovement (NetworkBehaviour)
Rigidbody-driven locomotion via MovePosition, gated to the local player (isLocalPlayer).
| Field | Default | Meaning |
|---|---|---|
moveSpeed / sprintSpeed | 5 / 9 | Walk vs. sprint |
jumpForce | 6 | Jump impulse |
rotationSpeed | 12 | Turn rate toward move/aim direction |
keepUpright | true | Locks the body upright (no tipping on slopes) |
lockCharacterRotation | false | Optionally pin facing (used during aim; can capture start rotation) |
useBackwardMovementAnimation | true | Plays a back-step anim when moving backward |
movementLocked | false | Hard stop (cutscenes/casting) |
PlayerMovement.Start sets anim.applyRootMotion = false. If an imported rig ships with Apply Root Motion on, the Animator drives the root while the Rigidbody drags it via MovePosition โ the mesh detaches and "flies wild in POV." This is not a camera bug. See Known Issues & Tech Debt.
Dodge roll
A built-in dodge (distinct from class ability dashes like DashHandler):
dodgeForce 14,dodgeDuration 0.35s(i-frames + movement burst)dodgeMaxCharges 2,dodgeRecharge 5sper charge, optionaldodgeVFX- Surfaced on the HUD as dodge pips (filled = ready). See UI & HUD Systems.
Camera โ CameraFollow (client-only)
A WoW/Smite-style third-person orbit rig. Cursor is free by default; hold right mouse to orbit (yaw + pitch), cursor locked only during the drag.
| Field | Default | Meaning |
|---|---|---|
distance (CameraZoomDistance pref) | 7 | Zoom distance, persisted between sessions |
minDistance / maxDistance | 1.5 / 20 | Scroll-wheel zoom range |
mouseSensitivity | 0.25 | Orbit speed |
minPitch / maxPitch | โ20 / 70 | Vertical clamp |
heightOffset | 1.6 | Look-at height on the target |
cameraCollision (+ radius/buffer/smooth) | on, 0.28 | Sphere-cast pull-in so the camera doesn't clip through geometry |
Design notes baked into the code:
- Position follows instantly (smoothing caused drift); the first-frame mouse delta is discarded to avoid a violent swing on the first orbit.
- A
_typingInUIflag suppresses orbit while typing in chat/console, so WASD/mouse in a text field doesn't spin the camera. See UI & HUD Systems. - The camera is wired in
OnStartLocalPlayer(not on spawn), which fixed the "camera never attaches" bug on non-host clients.
The multi-zone camera rule โ ZoneCameraDirector
Additive multi-zone loading (Zones, Scenes & Multi-Zone) means several scenes โ each potentially with its own camera โ are loaded at once. That broke movement in a subtle way:
WASD is camera-relative. If the controller binds to another zone's camera, your input is rotated by however that camera faces. ZoneCameraDirector enforces exactly one enabled camera in the container at all times (Camera.allCameras only returns enabled cameras), and applies the active zone's skybox/fog to that shared camera. This is ROADMAP 6.9, and the reason the approach changed mid-development. See Zones, Scenes & Multi-Zone.
Related movement systems
DashHandler,StealthHandler,SiegeModeHandler,IronTetherHandler,KineticReversalHandler,TransferProtocolHandler(Player/Scripts/) โ these are class-ability movement/state handlers, not general locomotion. See Ability Atlas & Synergies ยท Heroes & Classes.PlayerFallResetโ recovers a player who falls out of the world.- Mount (
MotorcycleController, Founder Bike) โ separate rideable traversal. See Mounts & Traversal.
How it developed
Movement/camera were among the most-iterated systems: the camera went from a basic follow to Smite-style right-mouse-drag orbit (2026-07-05), then a run of fixes for camera collision, attach-on-OnStartLocalPlayer, and aim drift (the character faces the cursor while aiming, without the camera fighting the cursor lock). Movement got slope/incline rotation cleanup, root motion removed from mobs and players, and finally the one-camera-per-zone director when the world went multi-zone. See Development History & Timeline.
Related: UI & HUD Systems ยท Zones, Scenes & Multi-Zone ยท Heroes & Classes ยท Mounts & Traversal